|
Posted by David Dorward on 12/29/09 11:37
tea-mad brit wrote:
> The last input in my form is hidden.
> <input type="hidden" name="required"
> value="name,email,phone,organization"/>
If you plan to serve your XHTML as text/html[1], then appendix C requires a
space before that /.
> I have been out of the loop with writing code for a while. This validates,
> but does not work. I am trying to avoid a user clicking on the send button
> and submitting a blank form. The form goes to a PHP handler and all that
> works fine.
What that code should do is submit to the server side script the data in the
value attribute attached to the key that is the value of the name field.
Nothing about it actually makes any fields required.
The server side script can then check what values were submitted based on
that field and complain to the user if they haven't entered the required
values.
You could also do something similar with client side JavaScript.
Either way, user's can modify the required input if the want to, so its no
good if you really want to prevent people not submitting those fields.
(OTOH, it does make it rather difficult for the user to have a successfully
processed form by accident).
[1] If you don't then you are going to have a really limited audience, if
you do then there isn't any point in using XHTML instead of the better
supported HTML 4.01 in the first place.
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
[Back to original message]
|