html - After changing the default response from a required statement form doesn't behave normal -
so after made these changes form won't accept input. meaning if don't put in first name says 'please enter first name". works should. if put in name still says same thing. won't recognize put in name. happens in each field , have refresh page make work. ideas?
<form action="register.php" method="post"> <p>first name: <input type="text" name="first_name" size="15" maxlength="20" required oninvalid="this.setcustomvalidity('please enter first name')"></input> </p> <p>last name: <input type="text" name="last_name" size="15" maxlength="40" required oninvalid="this.setcustomvalidity('please enter last name')"></input>></p> p>email address: <input type="text" name="email" size="20" maxlength="60" required oninvalid="this.setcustomvalidity('please enter valid email')"> </input>></p> <p>password: <input type="password" name="pass1" size="10" maxlength="20" required oninvalid="this.setcustomvalidity('please enter valid password')"> </input></p> <p>confirm password: <input type="password" name="pass2" size="10" maxlength="20" required></p> <p><input type="submit" name="submit" value="register" /></p> </form>
you need setcustomvalidity('') clear invalidated state of field.
you can see work here
<form action="register.php" method="post"> <p>first name: <input type="text" name="first_name" maxlength="20" required oninvalid="this.setcustomvalidity(this.willvalidate?'':'please enter first name')"/></p> <p>last name: <input type="text" name="last_name" size="15" maxlength="40" required oninvalid="this.setcustomvalidity(this.willvalidate?'':'please enter last name')"/></p> <p>email address: <input type="text" name="email" size="20" maxlength="60" required oninvalid="this.setcustomvalidity(this.willvalidate?'':'please enter valid email')"/></p> <p>password: <input type="password" name="pass1" size="10" maxlength="20" required oninvalid="this.setcustomvalidity(this.willvalidate?'':'please enter valid password')"/> </p> <p>confirm password: <input type="password" name="pass2" size="10" maxlength="20" required /></p> <p><input type="submit" name="submit" value="register" /></p> </form>
Comments
Post a Comment