SpeedCrazy Posted November 27, 2010 Posted November 27, 2010 (edited) Hi guys. I was following my assignment, out of a library book, and was making a basic multiple choice form, but i ran into a problem. My reset button is broken. The submit button does its job, but reset does nothing. I will give the whole code in case its a large error but here is the line in question: <form action=""> <fieldset> <legend>Imput-style Buttons</legend> <input type="submit"/> <input type="reset"/> </fieldset> </form> Here is the whole code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/xml; charset=utf-8" /> <title>Form</title> </head> <body> <h1>Basic multiple choice form.</h1> <fieldset> <legend>Favourites</legend> <form action=""> <p> <label>What is your favourite color?</label> <select id="selColor"> <option value="#ff0000">Red</option> <option value="#00ff00">Green</option> <option value="#0000ff">Blue</option> <option value="#00ffff">Cyan</option> <option value="#ff00ff">Magenta</option> <option value="#ffff00">Yellow</option> <option value="#000000">Black</option> <option value="#ffffff">White</option> </select> </p> </form> <form action=""> <p> <label>What is your favourite time of day?</label> <select> <option value="">Early Morning</option> <option value="">Mid-Morning</option> <option value="">Mid-Day</option> <option value="">Early Afternoon</option> <option value="">Late Afternoon</option> <option value="">Early Evening</option> <option value="">Late Evening</option> <option value="">Late Night.</option> </select> </p> </form> <form action=""> <p> <label>What is your favourite color?</label> <select> <option value="">Breakfast</option> <option value="">Lunch</option> <option value="">Supper</option> <option value="">Mid-Night Snack</option> <option value="">Other</option> </select> </p> <p> <label> If other please specify.</label> <input type="text" id="other"/> </p> </form> </fieldset> <form action="" > <fieldset> <legend>How much do you want to spend?</legend> <p> <input type="radio" name="radPrice" id="rad100" value="100"/>Too Much </p> <p> <input type="radio" name="radPrice" id="rad200" value="200"/>Way Tooooo Much </p> <p> <input type="radio" name="radPrice" id="rad300" value="300"/>You've got to be kidding! </p> </fieldset> </form> <form action=""> <fieldset> <legend>Please Check off your Life Goals</legend> <p> <input type="checkbox" id="chkPeace" value="peace"/>World Peace </p> <p> <input type="checkbox" id="chkHarmony" value="harmony"/>Harmony and Brotherhood </p> <p> <input type="checkbox" id="chkCash" value="cash"/>Hard Cash </p> </fieldset> </form> <form action=""> <fieldset> <legend>Imput-style Buttons</legend> <input type="submit"/> <input type="reset"/> </fieldset> </form> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a> </p> </body> </html> The whole thing validates with XHTML 1.0 Strict.(hence the tag) But it doesn't work. I have tried it in several different forms, with the same result. Help Please. Thanks in advance. EDIT: this stilll happens after re-writing the code in a different editor. Edited November 27, 2010 by SpeedCrazy Share this post Link to post Share on other sites More sharing options...
SpeedCrazy Posted November 27, 2010 Posted November 27, 2010 Even using just one option on the form, as in just the most basic form possible, does not reset upon the use of this button. Share this post Link to post Share on other sites More sharing options...
ARandomOWL Posted November 27, 2010 Posted November 27, 2010 Your buttons are in a separate forms to everything else. The buttons need to be in the same form as all the controls you want to submit values from or reset. If you caught the GET/POST data from your page it would contain nothing. You should remove all your forms and wrap all your fieldsets within one form. Share this post Link to post Share on other sites More sharing options...
SpeedCrazy Posted November 27, 2010 Posted November 27, 2010 (edited) Oh... That makes sense. Thanks. It changes the object placement. Though i should probably be doing placement with CSS anyway. Edited November 27, 2010 by SpeedCrazy Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now