Copy link to clipboard
Copied
Hello
I have a button which generates a list in a text field using the following script (on mouse down):
var total = ""; for(var i=1; i<=92; i++){ if(this.getField("priority"+i).valueAsString != "Off") total+="• "+this.getField("Text"+i).valueAsString+"\n";} this.getField("summary").value = total
I want to have a confirm popup (which I’m assuming will be along the following lines):
if(4==app.alert("Retrieve opportunities and skills priorities?",1,2))
How do I combine these scripts so that when the user clicks “no” to the popup message, the “summary” field remains unaltered? (i.e. any text already in “summary” does not update).
Many thanks
Mark
Just combine the two codes... Like this:
if(4==app.alert("Retrieve opportunities and skills priorities?",1,2)) {
var total = ""; for(var i=1; i<=92; i++){ if(this.getField("priority"+i).valueAsString != "Off") total+="• "+this.getField("Text"+i).valueAsString+"\n";} this.getField("summary").value = total
}
Copy link to clipboard
Copied
Just combine the two codes... Like this:
if(4==app.alert("Retrieve opportunities and skills priorities?",1,2)) {
var total = ""; for(var i=1; i<=92; i++){ if(this.getField("priority"+i).valueAsString != "Off") total+="• "+this.getField("Text"+i).valueAsString+"\n";} this.getField("summary").value = total
}
Copy link to clipboard
Copied
Thanks! I was missing out the "}" when i orignially tried combining.
Copy link to clipboard
Copied
In that case it should have given you an error message, like this:
SyntaxError: missing } in compound statement
3:Console:Exec
Copy link to clipboard
Copied
I'd missed both "{" and "}", so it was running, but pulling the list through regardless of what option was selected from the popup. All new to me, so figuring it out as i go. If I can be cheeky, could you also advise on a related issue? On a second confirmation popup, i have the following script:
if(4==app.alert("This action will clear the form.\nDo you want to continue?",1,2)) { this.getField("see").display = display.visible; this.getField("see").display = display.hidden; this.getField("add").display = display.visible; this.getField("add").display = display.hidden; this.resetForm(); }
But i'd also like to reset (turn white) the fill colour of a field following confirmation of the same popup. It’s probably simple, but I can’t quit figure out how I’d integrate the following script:
this.getField("coll").event.target.fillColor = color.white;
thanks, Mark
Copy link to clipboard
Copied
Use this:
this.getField("coll").fillColor = color.white;
Copy link to clipboard
Copied
Thats great, thanks.