Expand my Community achievements bar.

Reacting to a Character Entered into a TextBox

Avatar

Level 2

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)

basFields.setTimer();

function setTimer()

{

     app.setInterval("checkContinueA()",1)

}

function checkContinueA()

{

...

}

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

function setTimer()

{

    app.setInterval("app.alert('test')",1);

}

1 Reply

Avatar

Level 10

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

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.

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:

Hope that helps,

Nith