[thelist] Form input type RESET not working

Joel Canfield joel at spinhead.com
Sat Sep 7 11:33:01 CDT 2002


--
[ Picked text/plain from multipart/alternative ]
> For some reason, the following basic command is not working
> in my form: <input type="reset" value="Clear answers">.
>
> I've tested it in NN4.7, IE5.5 and N6.2 and it isn't working
> altho it works in other forms I've done.
>
> Any clues? I was thinking I might have to write an onClick
> event, but is this really necessary?
>
> url: http://www.chefsteve.com/html/ChefHACCPQuiz.html.
>
> TIA,
> Sharon

Hi Sharon.

The problem is that you have too many <form> tags, and the one that's most
nearly correct is in the wrong place.

Here's a 'form' tag, followed by some pseudo-code re: form layout -

<form name="theForm" id="theForm" action="formResponse.asp" method="post">
  <!--if you're using a table for layout, put the form tags *outside* the
table-->
  <table>
    <form elements and text>
    <submit button> <reset button>
  <close that table>
</form>

Notice - one pair of <form> tags around the entire form, not around each
element or set of elements.

Also, each set of radio buttons should have its own name. I assume you meant
to use 'q1' for question one, 'q2' for question two, etc. Makes sense.

(Advanced topic, but a nice usability touch: ideally you ought to give them
an id also, and give them each a label, thus:

4. Which is not a physical hazard?</strong><br>
  <input type="radio" name="q1" id="q1a" value="0"><label
for="q1a">toothpicks</label><br>
  <input type="radio" name="q1" id="q1b" value="0"><label
for="q1b">staples</label><br>
  <input type="radio" name="q1" id="q1c" value="0"><label
for="q1c">fingernails</label><br>
  <input type="radio" name="q1" id="q1d" value="0"><label
for="q1d">bandages</label><br>
  <input type="radio" name="q1" id="q1e" value="1"><label
for="q1e">parasites</label>

It's not the end of the world if you don't get this right now; if you wanna
go over it offline just let me know; otherwise, don't worry about it for
now.)

Finally, just in case you have any users bright enough to 'view source', I
think I'd come up with a better way to mark the correct answers ;) Use the
text of the answer (or a one-word representation of it) as the value of the
radio button, and do the scoring (1 or 0) on the server side, in the page
which is parsing the form. As it stands, I'm pretty sure my 12-year-old
could get a perfect score on the quiz 'cause he'd look at the code.

As always, let me know if I've confused you more than I've helped. I'd be
glad to write pages and pages more about this for you :)

joel



More information about the thelist mailing list