Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

xfa.event.change to substitute multiple keystrokes

Avatar

Former Community Member

I have some characters that are causing my parser problems - so while i sort that out i want to use a substitute as you go approach to weed them out

the keystrokes are < > & and '

am i able to modify this code:

xfa.event.change

= xfa.event.change.replace(/'/g,"´");

to work against all of those at one time --

so something on the change event that would work like this:

if new character is "<" then substitute "("

if new character is ">" then substitute ")"

if new character is "&" then substitute " and "

new character is " ' " then substitute the accent key " ´   "

   --- oh and can someone please tell me where I find/access the above accent on the keyboard/within livecycycle too ?

im working on the parser but need to go this way for now.......

any ideas appreciated - cheers

1 Accepted Solution

Avatar

Correct answer by
Level 10

You have to define a regualar expression for those characters you want exclude or replace while typing.

if (xfa.event.newText.match(/[<]/))    

{

xfa.event.change = "(";

}

if (xfa.event.newText.match(/[>]/))    

{

xfa.event.change = ")";

}

if (xfa.event.newText.match(/[&]/))    

{

xfa.event.change = " and ";

}

if (xfa.event.newText.match(/[']/))    

{

xfa.event.change = "´";

}

View solution in original post

4 Replies

Avatar

Level 10

Hi,

you can change the users input with some JavaScript in the change:Event.

See here

http://forums.adobe.com/message/3263685

Avatar

Former Community Member

Thanks Radzmar

Im familiar with the change event to modify one character stroke at a time

---I'm just not sure how to put the javascript together to deal with the

multiple characters i need to "weed out" at the same time:

do you have a similar code fragment i could have a look at perhaps?

thanks

Avatar

Correct answer by
Level 10

You have to define a regualar expression for those characters you want exclude or replace while typing.

if (xfa.event.newText.match(/[<]/))    

{

xfa.event.change = "(";

}

if (xfa.event.newText.match(/[>]/))    

{

xfa.event.change = ")";

}

if (xfa.event.newText.match(/[&]/))    

{

xfa.event.change = " and ";

}

if (xfa.event.newText.match(/[']/))    

{

xfa.event.change = "´";

}

Avatar

Former Community Member

Thank you - thats very helpful.

Appreciated.