We help IT Professionals succeed at work.

alert default to no

I am using the code below to show an alert when the 'clear form' button is pushed.  I would like it if 'no' is defaulted when the user hit enters because now if they hit enter the clear runs.  Or would it be possible to have nothing happen with the enter key, only a mouse click?
var nRslt = app.alert ("This will clear what is entered in all the fields in\n\n" +    "Are you sure?";,1, 2, "Submit Validation");
 
if(nRslt == 4){     //put the clear code here}

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Awarded 2010
Top Expert 2013

Commented:
What language is this? Flex?
If it's flex, then the alert takes seven parameters, the last one is the default button.
Look up the alert() function for whatever language you are using. There should be a default button option, set that to the value of the No button. In Flex it would look something like:
Alert.show('Message', 'Title', mx.controls.Alert.YES | mx.controls.Alert.NO, null, null, null, mx.controls.Alert.NO)

Author

Commented:
javascript in a PDF form
CERTIFIED EXPERT
Awarded 2010
Top Expert 2013
Commented:
Ah. There is no way to set the default for those.
You would need to make a custom dialog box
http://acrobatusers.com/tutorials/2006/popup_windows_part5

Or you could rephrase the question so that Yes is the cancel button

Author

Commented:
I will check out the custom dialog or perhaps word it differently as suggested.

Thanks for your time

Explore More ContentExplore courses, solutions, and other research materials related to this topic.