These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Using if, else if, and else in Javascript

Profy
Registered: Jul 15 2010
Posts: 19
Answered

form1.#subform[26].Save_Form::click - (JavaScript, client)
 
This script is ran under a button and will check the entire form to make sure all information is filled in before saving the form.
 
Everything works except for when I select "No" as an answer for the question Are_Other_Repairs_Needed.rawValue. , the last question on the form. What happens is that it will run through the script and see that the last question is answered "No" and go immediately to the else event and open my FakeSave button which will let the person save the form with all other questions not answered.
 
How can I stop this from happening, the only way I found so far is to answer "Yes" to the Are_Other_Repairs_Needed question. Then it will not let me save the form.
  
Please Help
 
Below is the link to the form
 
https://acrobat.com/#d=NGLoTD0eLLabypn35xCNPw
 

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Accepted Answer
Try creating variable to track if there are any answered items. You could use a counter to count how many unanswered questions there are. Then at the end of your script, check if this variable has a value of zero, if so then perform your submit.

George Kaiser

Profy
Registered: Jul 15 2010
Posts: 19
gkaiseril,

Thank you for the quick response, I understand what you are saying, but I am new to using variables. Could you explain more on how to get a variable and what the script is for counting?