6 Replies Latest reply on Aug 15, 2009 1:45 PM by gkaiseril

    How do I auto populate text and numeric fields

      I am a newbie, so if anyone can help please give me a detailed response. I am creating a form for my office using Live Cycle designer in Adobe Acrobat 8 Pro. What I am trying to do is autopopulate a text field with a certain city when a 4 digit number is entered in the numeric field. Example, if I enter 6514 in the numeric field, Dallas will automatically populate in the text field. I would need to do this for several different numbers and cities.Thank you in advance for any help.
        • 1. Re: How do I auto populate text and numeric fields
          Hi, see you haven't had a response.
          Create two fields called 'number' and 'city'. city is a drop down list: " ", "Dallas", "Boston"
          In the city field custom calc script put:

          //clear city field
          if (this.getField("number").value == " ")
          event.value = "";

          if (this.getField("number").value == "1234")
          event.value = "Dallas";
          if (this.getField("number").value == "5678")
          event.value = "Boston";

          etc.
          so an if/event couple for each of your numbers/cities.
          • 2. Re: How do I auto populate text and numeric fields
            Level 1
            sorry drop down list should be " ", "1234", "5678"
            • 3. Re: How do I auto populate text and numeric fields
              This is similar to what i am looking to do with one of my forms.
              I would like to have inventory items auto populate in seperate text fields when i input the company's name.
              For example:
              if i choose ABC Co.
              I would like 10 items to auto populate/fill into ten seperate boxes.
              Can anyone help please.
              • 4. Re: How do I auto populate text and numeric fields
                gkaiseril MVP & Adobe Community Professional
                For Acrobat Forms, not LiveCycle Designer, the 'On Blur" action could be:

                switch(event.value) {
                case 'ABC C0.':
                thisgetField('TextBox0FieldName').value = 'ABC value 0';
                thisgetField('TextBox1FieldName').value = 'ABC value 1';
                thisgetField('TextBox2FieldName').value = 'ABC value 2';
                thisgetField('TextBox3FieldName').value = 'ABC value 3';
                thisgetField('TextBox4FieldName').value = 'ABC value 4';
                thisgetField('TextBox5FieldName').value = 'ABC value 5';
                thisgetField('TextBox6FieldName').value = 'ABC value 6';
                thisgetField('TextBox7FieldName').value = 'ABC value 7';
                thisgetField('TextBox8FieldName').value = 'ABC value 8';
                thisgetField('TextBox9FieldName').value = 'ABC value 9';
                break;
                case "Next Selection":
                thisgetField('TextBox0FieldName').value = 'value 0';
                thisgetField('TextBox1FieldName').value = 'value 1';
                thisgetField('TextBox2FieldName').value = 'value 2';
                thisgetField('TextBox3FieldName').value = 'value 3';
                thisgetField('TextBox4FieldName').value = 'value 4';
                thisgetField('TextBox5FieldName').value = 'value 5';
                thisgetField('TextBox6FieldName').value = 'value 6';
                thisgetField('TextBox7FieldName').value = 'value 7';
                thisgetField('TextBox8FieldName').value = 'value 8';
                thisgetField('TextBox9FieldName').value = 'value 9';
                break;
                ... // and so on
                devault: // no match
                thisgetField('TextBox0FieldName').value = '';
                thisgetField('TextBox1FieldName').value = '';
                thisgetField('TextBox2FieldName').value = '';
                thisgetField('TextBox3FieldName').value = '';
                thisgetField('TextBox4FieldName').value = '';
                thisgetField('TextBox5FieldName').value = '';
                thisgetField('TextBox6FieldName').value = '';
                thisgetField('TextBox7FieldName').value = '';
                thisgetField('TextBox8FieldName').value = '';
                thisgetField('TextBox9FieldName').value = '';
                break;
                }
                • 5. Re: How do I auto populate text and numeric fields
                  averagejay

                  Hi there,

                   

                  I am just starting out...I tried this but had issues.  Is there a tutorial or an sample form somewhere for this.  I need an overview of this auto-populate process.  I am using LiveCycle Designer ES to create a pdf where you can select a part description from a drop down and populate a price field (numeric) and a part number field (text).  Thanks in advance for your help.

                  • 6. Re: How do I auto populate text and numeric fields
                    gkaiseril MVP & Adobe Community Professional

                    This is a forum for Acobat's AcroForms JavaScripting, you might want to try the one of the LiveCycle forums.

                     

                    LIveCycle Designer

                    LiveCycle Designer ES

                    LiveCycle Designer ES Forms