PDA

View Full Version : Require Form Input


TruthElixirX
08-06-2006, 09:35 PM
My knowledge of HTML escapes me and google was of no help.

How do I make a field on a form required? >.>

Guest190829
08-06-2006, 09:39 PM
My knowledge of HTML escapes me and google was of no help.

How do I make a field on a form required? >.>

Well you can't do that with HTML alone, you would need to use PHP or Javascript.

TruthElixirX
08-06-2006, 09:45 PM
Well you can't do that with HTML alone, you would need to use PHP or Javascript.
Ah, any links or instructions to point me in the right direction?

Maybe vB already has this built in? I am doing this on a vB board.

aggiefan
08-06-2006, 11:40 PM
This will make it show up in a standard error message from vbulletin.

Put it after the submit button action.


if ($formanswer == '')
{
$errormessage="you need to answer this question since it's required";
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
exit();
}

TruthElixirX
08-06-2006, 11:47 PM
This will make it show up in a standard error message from vbulletin.

Put it after the submit button action.


if ($formanswer == '')
{
$errormessage="you need to answer this question since it's required";
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
exit();
}
How do I apply this to a specific field?

Abe1
08-07-2006, 01:16 AM
How do I apply this to a specific field?
It can't. This would stop the user from going further but giving them an error when tey click submit.

TruthElixirX
08-07-2006, 10:53 PM
okay.. so.. I'm more confused now then when I started...

Guest190829
08-07-2006, 10:56 PM
Javascript Tutorial:

http://www.javascriptkit.com/javatutors/form6.shtml

For php it's just checking if a variable is empty.

TruthElixirX
08-09-2006, 07:51 PM
Javascript Tutorial:

http://www.javascriptkit.com/javatutors/form6.shtml

For php it's just checking if a variable is empty.
Thank you Danny!