1 Reply Latest reply on Jun 18, 2011 10:22 PM by $Nith$

    Reacting to a Character Entered into a TextBox

    geoff_olding Level 1

      Hello there


      Is there a way to react to the input of a new character into a textBox?


      I am creating a dynamic XML form using Designer 8.2.


      If you add code to the change event, the rawValue property contains the value of the field before the latest character was entered.


      I have also tried using a timer, which doesn't work:


      topmostSubform.Page2.sfAbout.sfLimitedCompanies.txtRegisteredNumber::change - (JavaScript, client)




      function setTimer()





      function checkContinueA()





      The function checkContinueA() doesn't get called.  N.B. the following code does work:


      function setTimer()




        • 1. Re: Reacting to a Character Entered into a TextBox
          $Nith$ Level 4

          setInterval method will invoke the specified method call iff you provide the complete SOM of the method signature.


          e.g app.setInterval("xfa.form.form1.page1.fieldname.checkContinueA()",1) should work


          I have just explained about setInterval issue; However, this will not solve your problem!



          What you would like to happen when a character is entered into a textbox?


          on change event, the .rawValue property will not return the actual value.


          Instead, you can try using xfa.event.newText which will return the exact value entered.


          e.g the following code checks if the data entered into the field is at least 10 chars.


          if(xfa.event.newText.length < 10)


               txtErrorMsgField.rawValue = "The password must be atleast 10 characters";



               txtErrorMsgField.rawValue = "";




          Or, If you would like to react to each character entered, you can try xfa.event.change property which return each character entered.


          e.g the following code converts each character entered to its lower case:


          xfa.event.change = xfa.event.change.toLowerCase();



          Hope that helps,