Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Please Help - Conditional Hide/Show and Message Boxes also E-mail Submit Issues

Avatar

Level 2

I am creating a fillable Dynamic XML form that is a fourteen page survey.  It has a series of Yes/No Radio Buttons which hide/show additional questions.  The survey needs to perform several other functions as well.  Ten of the questions are mandatory, which I have set in the Object pallet.  If a user selects "No" for any of these ten questions, an additional page should appear at the end of the survey for them to complete.  Currently, if a user chooses "No" the additional page appears, but if the user changes a "No" response to "Yes" the page does not disappear.  The script I have for this is as follows:

  if (Comp1No.selectedIndex == 2

  || Page4.Comp2.Comp2No.selectedIndex == 2

  || Page5.Comp3.Comp3No.selectedIndex == 2

  || Page6.Comp4.Comp4No.selectedIndex == 2)

     (continue same pattern through 10)

{

  CorrectiveAction.presence = "visible";

  }

else {

  CorrectiveAction.presence = "hidden";

  }


The user will be submitting this survey by clicking a "Submit by E-mail" button at the bottom of the form.  I need to add a preSubmit action that reviews responses for the ten mandatory questions and returns a message box to the user stating "You must complete the Correction Action Plan" if any of the responses are "No".  I currently have a mailto:me@myemail.com in the Object pallet under the Submit tab in the Submit to URL: field and PDF in the Submit As field as I need a pdf copy of the document returned to me attached to the e-mail.  Lastly, I would like to make the Corrective Action page a mandatory item if any of the responses to the mandatory questions are "No" but do not know how to make the mandate conditional so that is the user's responses are all "Yes" the Corrective Action is not mandatory.

Any assistance you can give me would be greatly appreciated.  I have no programming, HTML, or Javascript knowledge and am a trying to fumble my way through this project using Help, forums, and any other information source available.  Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 10

I looked at the form and found one thing..

You are referencing the Pages as Page3, Page4, Page5 etc in your code..But actually you donot have a subform named Page3/ Page4/ Page5 in your form. If you look at the attched diagram, you will understand that in the Heirarchy it looked like Page3 but if you look at the Script editor in your event code, you can see the actual reference to the Yes radio button.

    

Actual path for Comp1Yes button:   form1.#subform[2].Comp1.Comp1Yes::mouseUp

You have referenced in your code as: Page3.Comp1.Comp2No.selectedIndex == 2..

To make your code work, you need to change the Subform to Page3/ Page4 etc.

Go to Window Menu - >Heirarchy and then select "(Untitled Subform) (Page3)" and press F2. Change the name to Page3. Do the same for every page you have in your form..Can you can select the Comp1Yes button and you should see the proper path in Script Editor.

     form1.Page3.Comp1.Comp1Yes::mouseUp

This way you can able to refer to Page3/ Page4 etc in your code.

Let me know if this helps..

Thanks

Srini

View solution in original post

4 Replies

Avatar

Level 10

Can you post your form, so I can have a look at it.

Thanks

Srini

Avatar

Level 2

I attached a copy of the survey and e-mailed to the address you provided.

Avatar

Correct answer by
Level 10

I looked at the form and found one thing..

You are referencing the Pages as Page3, Page4, Page5 etc in your code..But actually you donot have a subform named Page3/ Page4/ Page5 in your form. If you look at the attched diagram, you will understand that in the Heirarchy it looked like Page3 but if you look at the Script editor in your event code, you can see the actual reference to the Yes radio button.

    

Actual path for Comp1Yes button:   form1.#subform[2].Comp1.Comp1Yes::mouseUp

You have referenced in your code as: Page3.Comp1.Comp2No.selectedIndex == 2..

To make your code work, you need to change the Subform to Page3/ Page4 etc.

Go to Window Menu - >Heirarchy and then select "(Untitled Subform) (Page3)" and press F2. Change the name to Page3. Do the same for every page you have in your form..Can you can select the Comp1Yes button and you should see the proper path in Script Editor.

     form1.Page3.Comp1.Comp1Yes::mouseUp

This way you can able to refer to Page3/ Page4 etc in your code.

Let me know if this helps..

Thanks

Srini