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.
Text only in field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
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.
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.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
thank you
Thanks Jan the answer was literally right in front of my face, LOL.