3 Replies Latest reply: Aug 20, 2012 3:44 PM by BR001 RSS

    Can't access textfield value from another page

    Deadbuddha

      Hello there, I thought this would be straight forward and simple, but I have hit a wall.

       

      I cant seem to access values from another page in a script.

       

      I'm trying to set a value of a text field to the value of a text field that is in another page.

      On the click event(just for testing) I have:

       

       

      eApp.ENB-7-07-CAGAIN_Page_5.a3z_data_AdditionalInfo::click - (JavaScript, client)

       

      this.rawValue =  eApp.ENB-7-07-CAGAIN_Page_4.AccountNumber.rawValue;

       

      It doesnt get the value.

       

      But if i copy create a field on the same page(page 5 here) with the same info, I can access

      with this.parent.AccountNumber.rawValue;

       

      I can get it to work, by copying the textfields to the page and hiding them, then using their value,

      but this seems messy and unnecessary.

       

      I just want to be able to access fields on another page, I would have thought it would be as easy as form.page4.accessthisvalue

       

      Any help is DEEPLY appreciated, been banging my head for a loong time.

        • 1. Re: Can't access textfield value from another page
          BR001 Community Member

          Hi,

           

          There should not be a problem doing this, you can reference a field anywhere on the form.  Are you getting any script errors?  My first guess would be to rename the field ENB-7-07-CAGAIN_Page_4 so that it does not have the hyphen character in it, it might be trying to subtract 7 from a variable it thinks is called ENB.

           

          Regards

           

          Bruce

          • 2. Re: Can't access textfield value from another page
            Deadbuddha Community Member

            Wow I am shocked, I think the - character makes it crash for some reason.

            I took out the dash in the name and it worked.

             

            Sadly I cant really remove the dashes from the final product, so need to find a way of referencing it with the dashes.

            Looking into get element, not sure if it might work.

            Any input is appreciated.

             

            By the way, I appreciate the help immensely, it gave me direction and saved some of the little sanity I have left.

            • 3. Re: Can't access textfield value from another page
              BR001 Community Member

              Hi,

               

              Glad I could help,

               

              If you can't get rid of the hyphen from the field name you could try either;

               

              this.rawValue = eApp.resolveNode("ENB-7-07-CAGAIN_Page_4").AccountNumber.rawValue

               

              or

               

              this.rawValue = eApp["ENB-7-07-CAGAIN_Page_4"].AccountNumber.rawValue

               

              You can also change the binding name so the XML still comes out with a hyphen but the field name uses something else.

               

              Regards

               

              Bruce