[thelist] js form validation problem - still not working

Burhan Khalid burhankhalid at members.evolt.org
Mon Jun 17 03:01:00 CDT 2002


Hey Karen :

	I messed around with it for a while. The only solution that I
found (rather interesting) was this :

	function chkStockNum(fld, num, wine) {

	var sv = fld.value
	if (isNaN(sv)) {
		//fld.select();
		//fld.focus();
		fld.value = prompt("Please enter a valid number for the
bottles of "+wine);
		return false;

	}
	else if (sv > num) {
		fld.value = prompt("There are only " + num + " bottles
of " + wine + " available.  Please enter a lower number.");
		//fld.select();
		//fld.focus();
		return false;
	}
	return true;
}

hth,
Burhan





More information about the thelist mailing list