Evaluate input in field

Questions, tips and tricks and techniques for scripting in Servoy

Evaluate input in field

Postby pbakker » Tue Jan 27, 2004 10:42 pm

Hi all,

Probably something very basic, but it leaves me a bit clueless right now.

I have a field, which is attached to a global that I use as an input field for a search. Now, the search needs an ID (Integer) as input. the question is now: How to evaluate the input in the field, to see if it is an integer?

Secondly: Is it possible to put a mask or something over the field so the user can only type numbers into the field?

Thirdly: is it possible to evaluate the value typed into the field, while it's being type? With this one I mean: evanualte the total value in the field after each character entered into the field

Last but not least :-) : Based on the evaluation in 3 launch a method (for example to change the text in the field to Bold or another color)

Any help appreciated

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby IT2Be » Wed Jan 28, 2004 11:38 am

I will see if I have the right answers here...

I have a field, which is attached to a global that I use as an input field for a search. Now, the search needs an ID (Integer) as input. the question is now: How to evaluate the input in the field, to see if it is an integer?


If you want to check if all characters are a number you can do value.match(yourregularexpression) to find out. If you want to filter an integer you can do utils.stringToNumber(value) and you have your integer.

Secondly: Is it possible to put a mask or something over the field so the user can only type numbers into the field?


No (and this is a not yet if it was up to me... but it isn't :D )

thirdly: is it possible to evaluate the value typed into the field, while it's being type? With this one I mean: evanualte the total value in the field after each character entered into the field


No, not as far as I know. It is only after changing the values that you can do your evaluation...

Hope this helps you a little...[/quote]
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany


Return to Methods

Who is online

Users browsing this forum: No registered users and 2 guests

cron