Chris Pratt wrote:
On Tue, Feb 26, 2008 at 10:49 PM, Sanjeewa Saman <[EMAIL PROTECTED]> wrote:
Hi all ,
Can some body please tell me a way to restrict the data that we can eneter
to a textfield in struts2.
What I wanted to do is , for the s:textfield , I need to enter only values
these values {1-10 , +,-,.} .
The only way I know would be to use JavaScript in an onkeyup handler
that would check the entered value.
(*Chris*)
If it's unacceptable for the user to even be able to type in 'invalid'
characters then yes. If it's OK to let them type anything but then
notify them after the fact that what they entered isn't acceptable,
there are a few more options. If it's OK for that notification to be
produced as part of the server-side validation when the form is
submitted and redisplayed, it's as easy as using a regex validation rule.
So, sanjeewa, it depends on your exact requirements. I would start by
adding in server-side validation (since that should be there anyway)
then look at adding additional, client-side Javascript
checking/reporting afterwards if you still feel you need it.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]