Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Answer dependant message box

Avatar

Former Community Member
I am trying to add a message box when a user chooses the answer of "yes" from either a radio button or a drop down. For example, if the user chooses "no", I would like them to continue to fill out the form. If the user chooses "yes" I would like a message to pop up and state that they can't participate in the study based on their response.



Is this possible?
4 Replies

Avatar

Former Community Member
Yes, it's possible. Have a look at the LCD Help under "messageBox method" (do a search of the index)

Avatar

Former Community Member
Thank you. However, I am new to scripting in LCD and this doesn't seem to be working.



Could you please tell me what I am doing wrong? I want a message stating, "Sorry, you do not qualify for this study." to pop up when the radio button "yes" is clicked. The help states that I need to add this line:



$host.messageBox( STRING param1 [, STRING param2 [, INTEGER param3 [, INTEGER param4 ] ] ] )



So, I selected the "yes" radio button and typed this into the Script Editor:



$host.messageBox( STRING Sorry you do not qualify for this study param1 )



I removed the other parameters since the help states that they are optional. By the way, I placed this line of text after one that was already there:



----- form1.#subform[0].RadioButtonList.#field[0]::validate - (FormCalc, client) -------------------



When I check the PDF preview I get an error stating that the script failed (language is formcalc; context is xfa[0].form[0]form1[0].#subform[0].RadiobuttonList[0].#field[0])script=$host.messageBox(STRING Sorry you do not quality for this study param1) Error:syntax error near token 'Sorry' on line 1, column 30.



Any help would be much appreciated.

Thanks.

Sarah

Avatar

Former Community Member
String is the type, you don't actually type the word string in your script. It should look like this:



$host.messageBox("Sorry you do not qualify for this study")



Also, you may want to put it on the click event instead of the validate event.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
That did it. Thanks again for your help.

Sarah