1 Reply Latest reply on Jan 29, 2012 8:42 AM by maxwyss

    Radio button to field

    akshayny1 Level 1

      Ive got a lot of help from this forum so far and I appreciate all your support. I was wondering what the code would be for the question below:

      I have a question that goes like this:

       

      My Parents Current Marital Status is:

      o Married

      o Seperated/Divorced

      o Single

       

      Date___________

       

      Next question (radio button format) goes here....

       

      The parents question is a set of mutually exlcusive radio buttons with different export values like "married" or "divorced." How do I enforce that students type the date when married or sperated/divorced is selected before they proceed to the following question?

       

      I was thinking something like:

       

      if(event.value == "divorced" && dateField = null)

      {

           nextQuestion.setVisible = hidden;

      }else

      nextQuestion.setVisible = true;

       

      This code is so amateur but Im hoping you guys get the point here. I appreciate all the help and support I can get. Thanks guys!

        • 1. Re: Radio button to field
          maxwyss Level 4

          If you are in a PDF form (not created using LiveCycle Designer), things are relatively simple. As Checkboxes and Radiobuttons don't have the full set of field processing events, you would either use an external field for a calculation, or you would use the mouseUp event of the Checkbox/Radiobutton.

           

          If you are using the mouseUp event of the checkbox/radiobutton, your code would look like this:

           

          We assume that the fields for the next question have the name base "nextq"

           

          if (event.value == "divorced" && this.getField("date").value == this.getField("date").defaultValue) {

          this.getField("nextq").readonly = true ;

          } else {

          this.getField("nextq").readonly = false ;

          }

           

          Of course, this can be etended, such as by deleting the field values in nextq when setting the fields readonly.

           

          Hope this can help.