HTML / JS - form onsubmit not iterating through possibilities

Nazgul

New Member
First time posting here, last alternative to getting even more frustrated with this non-sense. I see nothing wrong with this code segment and yet the onsubmit condition seems to be always returning as true, even if I leave the fields blank (which should be verified on the spot). NOTE: my JS functions are blank at the moment, haven't gotten that far yet.Further investigation note: even the final case which I wrote to be a catch all is not working, it's simply trying to reach the checkout page as soon as I hit submit and completely ignoring the onsubmit.\[code\]<?xml version = "1.0" encoding = "utf-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Book > registration. </title> <script type = "text/javascript" src = http://stackoverflow.com/questions/13749767/>'Script/main.js'></script> </head> > > <body> <form method = "POST" action = "Checkout" onsubmit = > "validate(this)"> <fieldset> <legend> Book Registry Access > </legend> > <p> ISBN: <input type = "text" size = "14" name = "ISBN" onchange = "if(this.value != '') ajaxVerif('checkISBN', this.value, this.id);"> </p> <p> Title: <input type = "text" size = "32" id = "title" name = > "title"> </p> <p> Author: <input type = "text" size = "32" id = > "author" name = "author"> </p> <p> Edition: <input type = "text" > size = "2" id = "edition" name = "edition" onchange = "if(this.value > != '') ajaxVerif('checkEdi', this.value, this.id);"> </p> <p> <input > type = "submit"> </p> > </fieldset> </form> </body> </html> function validate(thisForm) { if (thisForm.ISBN.value =http://stackoverflow.com/questions/13749767/='') { alert('Please enter a valid ISBN number in the form XXXX-YYYY-ZZZZ'); this.ISBN.focus(); return false; } if (thisForm.title.value =http://stackoverflow.com/questions/13749767/='') { alert('Please fill in the title field.'); this.title.focus(); return false; } if (thisForm.author.value =http://stackoverflow.com/questions/13749767/='') { alert('Please fill in the author field.'); this.author.focus(); return false; } if (thisForm.edition.value =http://stackoverflow.com/questions/13749767/='') { alert('Please enter a valid edition number.'); this.edition.focus(); return false; } alert('Success! This test form is working! (TO BE DELETED!!)'); return false; }\[/code\]EDIT: edited for cleanliness, still cannot get it to work. I will either tell me that there's no ISBN then when I click on the OK will go to checkout anyways or it will just auto go to checkout if I fill out the ISBN.
 
Back
Top