|
I respectfully request assistance with this rather simple, yet
buggy Javascript.
Here's the function:
<!---This checks the barcode number against the possible
ranges--->
function barcodeRange(barcode) { if (!((barcode.value >= '21386000000000' && barcode.value <= '21386000999999') || (barcode.value >= '22222000000000' && barcode.value <= '22222009999999'))) { alert("Enter your full UT Southwestern Library card number with no spaces") window.document.searchreq.barcode.focus(); } } Obviously, I could not use CFINPUT's Range parameter, since it must be
within one of 2 different ranges.
Here's the form action:
<CFFORM action="searchreqprocesstest.cfm" onSubmit="return
barcodeRange(this.searchreq.barcode)"
method="post" TARGET="_top" Name="searchreq"> And here's the field:
<INPUT name="barcode" type="text" size="25"
onChange="barcodeRange(this)">
My problems are two-fold:
1) When activating the onSubmit event handler, it brings up the error
message when necessary, but when I click "OK", it sends the form, rather than
focusing on the barcode field.
2) When activating the onChange event handler, it brings up the error
message, but does not return the focus to the field, but rather to the next
field.
Thank you, in advance, for any and all assistance you may offer.
Karen R. Harker, MLS
UT Southwestern Medical Library 5323 Harry Hines Blvd. Dallas, TX 75390-9049 214-648-1698 http://www.swmed.edu/library/ |
