|
-
October 13th, 2008, 11:27 PM
#1
javascript
Hi all
I have textbox(server side) and label
when i enter a value more than 150 need to display an error message like more than 150 and when i enter a value below 30 need to display anoter error
i write a javascript for this but it is not firing
neeed to write in textchange event
txtPress.attribbutes.add("OnTextChanged","return validPress();")
Thanks in advance
-
October 14th, 2008, 10:33 AM
#2
Re: javascript
you probably don't want to do it with the event "OnTextChanged". That will fire when they type in 1, and they will get the error message.
you may want to try it on the "OnUnload" event.
and your code should probably be this...
Code:
txtPress.Attributes.Add("onunload", "validPress();");
if that doesn't work, you can write the entire javascript function in the code behind, using a StringBuilder
kinda like this:
Code:
StringBuilder sb = new StringBuilder();
sb.Append("<script language='javascript'>");
sb.Append("alert('Hi');");
sb.Append("<");
sb.Append("/script>");
txtPress.Attributes.Add("onunload", sb.ToString());
-
October 14th, 2008, 09:18 PM
#3
Re: javascript
OnBlur will likely be the best option, though you'll want to make sure to have full validators on the fields anyway in case javascript is disabled.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|