[thelist] js form validation problem

Jeff C jeffc33 at hotmail.com
Thu Jun 13 10:31:00 CDT 2002


Try changing the return true to return false.


>From: "Karen J. Bowen" <karen at miinx.com.au>
>Reply-To: thelist at lists.evolt.org
>To: thelist <thelist at lists.evolt.org>
>Subject: [thelist] js form validation problem
>Date: Fri, 14 Jun 2002 00:02:03 +1000
>
>I'm having a problem with returning the focus to the correct form
>element after doing simple js validation.
>
>The JS is:
>
>function chkNum(sName) {
>	var sv = sName.value
>	if (isNaN(sv)) {
>		alert("Please enter a valid number.");
>		sName.select();
>		sName.focus();
>	}
>	return true;
>}
>
>
>And the form element calls it thusly:
>
><input type="Text" name="stock<%=i%>" class="txtbox2" size="4"
>onchange="chkNum(this)">
>
>The problem is that while the correct element is being selected, the
>focus is going to the next element.
>
>This is bizarre, and I just can't see why it's happening.  (it's
>occurring in both moz & ie)
>
>Thanks for any help!
>
>Karen
>
>
>
>--
>For unsubscribe and other options, including
>the Tip Harvester and archive of thelist go to:
>http://lists.evolt.org Workers of the Web, evolt !


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx




More information about the thelist mailing list