HighDots Forums  

Re: How to prevent Mozilla using a link if a wrong number is in an input box

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: How to prevent Mozilla using a link if a wrong number is in an input box in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stefan Mueller
 
Posts: n/a

Default Re: How to prevent Mozilla using a link if a wrong number is in an input box - 02-01-2006 , 06:39 PM






I've a huge table with many input fields. For each input field I'd like to
program a Javascript function which checks if the input is correct (e.g.
date in the right format / only numbers / number not below zero / ...) if
the focus leaves the input field. Today I do this with onBlur and it works
quite well.
If you click on the header of the table (href) the corresponding column gets
sorted. If you've entered a wrong input and you click on the header of the
table, the table gets not sorted but you see the alert message 'Wrong numer'
according to my example.
However, this works only with Internet Explorer and Opera. With Mozilla
Firefox you get the alert message 'Wrong numer' but the table also gets
sorted and the input field with the wrong input lost its focus.

Is there any way to prevent Mozilla from executing the href (sort of the
table / in my example jump to www.google.com) if the input of the input
field is not correct?
Stefan



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.