Page 1 of 1

Text only in field

Posted: Mon Sep 22, 2008 3:25 am
by reelstuff
I have a card that requires the user to enter some text to fill out some variables in a form.

I encountered a problem where the user could hit the return key,
placing a CR after the entered text.

I am guilty of doing this myself, while filling out forms, most of the time it would not matter however in this case, a CR is not wanted.

I began to wonder if there were a way to make sure that there is not a CR in the field, as the rest of the script depends on each line of the script to be on its own line.

So a CR in a text field, would create a new line where it is not wanted, which breaks the script.

Any thoughts on this, I tried a couple of different things, but it appears that even if you use the IF statement the field will still accept a CR.

Thanks in advance for any suggestions.

Posted: Mon Sep 22, 2008 6:33 am
by Janschenkel
The easiest method is to set the 'autoTab' property of the field to true. This way the engine will automatically 'tab' to the next field if the user enters a CR into the field.
Note that you can still allow multiple lines in such a field by tweaking the height: if two lines would fit without causing the text to 'scroll up' then the return won't send the focus to the next field until the user hits CR a second time.
Also look at the 'returnInField' and 'enterInField' messages in the Revolution dictionary.

Hope this helped,

Jan Schenkel.

thank you

Posted: Mon Sep 22, 2008 10:43 am
by reelstuff
Thanks Jan the answer was literally right in front of my face, LOL.