3 Replies Latest reply on Aug 24, 2016 8:12 AM by Princeplanet

    Adding custom value

    Princeplanet

      I have a form that fills out information for a Funeral (I work at a church).

      For the Funeral Home value, I have it set as a pull-down that I can pick certain values. The Funeral Home is listed under Options (the Item Name is the Funeral Home; the export value is the telephone number.

      I have a blank Item Name, and I have it set to add custom text.

       

      For the Funeral Home Phone field, I have a custom field script to bring up that phone number (event.value = this.getField('Funeral Home').value)

       

      For the most part, this is all I need. Easy as pie (after I read various explanations on how to do it). My difficulties arise when I want to place a custom text for the 'Funeral Home' value and want to put a custom text for the 'Funeral Home Phone' value. When I type in the custom text for the 'Funeral Home' value, I receive the same exact words for the 'Funeral Home Phone' value. When I go to change the phone number, it automatically reverts to the custom words that I put in for the Funeral Home.

       

      How can I continue to use a custom text for the 'Funeral Home' field and a custom text for the 'Funeral Home Phone' field?

       

      Thanks. I'm not a programmer. I googled everything for the above scenario.

      If this is not in the correct venue, I am sorry; point me in the right direction.

      Acrobat 9

        • 1. Re: Adding custom value
          George_Johnson MVP & Adobe Community Professional

          It sounds like you're using a custom calculation script for the phone number field. Is that right? If so, one way would be to instead use a custom Keystroke script for the dropdown that sets the phone number when the funeral home is selected. The user can then enter anything they want in the phone field.

           

          Another option is to revise the calculation script in the phone number field to allow the user to overwrite the calculated value.

           

          If you want more guidance, it would be helpful if you posted the script you're currently using.

          • 2. Re: Adding custom value
            Princeplanet Level 1

            Here is what I did.

            I have the one field as a drop down (Funeral Home). Under properties>options I have various Funeral Homes listed as the items. Under the Export Value for each item I have their phone numbers. When filling out the form, I pick a drop down item.

             

            I also have "Allow user to enter custom text" checked.

             

            The second field (Funeral Home Phone) automatically updates itself with the export field from "Funeral Home" I use the following:

            (located at -> Properties>Calculate>custom calculation script)

             

            event.value = this.getField('Funeral Home').value

             

            When I enter a custom text for "Funeral Home", it automatically enters the same exact text for "Funeral Home Phone"

             

            I'm looking to be able to enter the phone number to that custom text.

             

            Thanks. I'm not a programmer. I found out about the above script by googling.

            • 3. Re: Adding custom value
              Princeplanet Level 1

              ! !@After Googling and experimenting, I came up with the following script to allow custom text for the phone number:

               

              // Allow user data input

              if (event.source!=event.target) { !

                  event.value = this.getField("Funeral Home").value;

              }

              // Perform calculation only if a specific field is changed

              if (event.source && event.source.name=="Funeral Home") {

                  event.value = this.getField("Funeral Home").value;

              }

               

              This allows me to make changes to the phone number without it reverting back.

               

              However, this brings up another small problem (I can easily live with it, but if someone has a solution, I would be grateful).

              There is a third field that automatically takes the number from the "Funeral Home Phone" field and prints the address in another field, "Funeral Home Address". Once again all is well unless I use a custom written phone number. After I type in a custom address, the "Funeral Home Phone" reverts to the custom text of "Funeral Home". I can go back and retype the custom phone number with !no problem and without the address being changed, but it would be nice if I wouldn't have to worry about it.

              Here's the script that I use for "Funeral Home Address":

               

              var a = this.getField("Funeral Home Phone").value;

              if (a=="(800) 111-1111") event.value = "F.H. Address: 111 Street Name, City, State Zipcode"; [I changed the actual address and phone number.]

              else if (a=="(800) 222-2222") event.value = "F.H. Address: 222 Street Name, City, State Zipcode"; [I have more addresses listed]

              else if (a==" ") event.value = "F.H. Address: " [this is the last line in the script]

               

              Any help would be highly appreciated.

              Here's a modified version of the pdf file (I changed the names and telephone numbers for privacy reasons).

              Working Document.pdf - Box