pinaldave
asked on
multiple text box validation for int only onblur or mouse out...
hello Experts,
I have one form with many checkbox.
I would like to have javascript when mouse is moved out from that field or onblur ( which ever is correct you think) ... I want to validate that if that is int only...
if not alert 'pls enter int' how can I do that.
Regards,
---Pinal
I have one form with many checkbox.
I would like to have javascript when mouse is moved out from that field or onblur ( which ever is correct you think) ... I want to validate that if that is int only...
if not alert 'pls enter int' how can I do that.
Regards,
---Pinal
onblur = "if(isNaN(this.value)){ale rt('Please enter numbers');this.select;this .focus();} "
<input onchange="if (/\D/.test(this.value)){al ert('integ ers only please');this.focus()}" onblur="this.onchange()">
this is better
<input onchange="if (/\D/.test(this.value)){al ert('integ ers only please');this.focus()}">
<input onchange="if (/\D/.test(this.value)){al
ASKER
Gwyn and Arch
Both works. Thank you very much.
<input onchange="if (/\D/.test(this.value)){al ert('integ ers only please');this.focus()}"> how can I have focus back to the field which has the not an integer.
Thank you. It is moving the focus to where ever I have clicked. It should not let me enter any thing else than integer... cause it is moving the focus from that field and I can still submit it and my application is crashing.. somehow due to some complexity I am not able to use server side validation.
Regards,
---Pinal
Both works. Thank you very much.
<input onchange="if (/\D/.test(this.value)){al
Thank you. It is moving the focus to where ever I have clicked. It should not let me enter any thing else than integer... cause it is moving the focus from that field and I can still submit it and my application is crashing.. somehow due to some complexity I am not able to use server side validation.
Regards,
---Pinal
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Arch Just tried your solution again...
it does not work.. thank you both of you for helping me... all the time...
I still need help.
Regards,
---Pinal
it does not work.. thank you both of you for helping me... all the time...
I still need help.
Regards,
---Pinal
I think the above does it.
Thx for the points. :-)
ASKER
<input onblur="if (/\D/.test(this.value)){al ert('integ ers only please');this.focus()}">
works and good suggestion.
No.. I do not want float Just an integer...was working on server side validation for more than one hour.. this will do the same job...
Regards,
---Pinal
works and good suggestion.
No.. I do not want float Just an integer...was working on server side validation for more than one hour.. this will do the same job...
Regards,
---Pinal
ASKER
Look out for another Q which I will post in a min... pls...
Thank you.
---Pinal
Thank you.
---Pinal