2 Replies Latest reply on Jun 23, 2011 11:17 AM by RenéG

    Left side vs right side of Form

    RenéG Level 3

      I have a form that's divided in 2: left side and right side

       

      If the person fills out her name on the left side of the form, her name should be populated on the right side of the Form too – that I can do, with the fields having the same name.

       

      What I don't know how to do is if the person fills out her name on the right side of the Form, her name shouldn't populate the field (with the same name) on the left side of the Form.

       

      Is that possible with a script?

       

      Let me know, thanks.

        • 1. Re: Left side vs right side of Form
          George_Johnson MVP & Adobe Community Professional

          First, don't give the fields the same name. You can then use a script like the following as the Validate script for the text fields on the left side:

           

          // Copy field value to other field
          getField("text1_right").value = event.value;
          

           

          If you only want to copy to the other field if the other field is blank, you can do this instead:

           

          // Custon validate script for text field
          (function () {
          
              // Get a reference ot the other field
              var f = getField("text1_right");
          
              // Copy value only if the other field is blank
              if (!f.valueAsString) {
                  f.value = event.value;
              }
          
          })();
          

           

          Change the field name from "text1_right" to the actual name you're using.

          • 2. Re: Left side vs right side of Form
            RenéG Level 3

            Thanks George. The first script does what I need.