I want a way to have my form have a required field so if it's left blank, the form won't be sent and I can control the number of blank e-mails I get sent. Any help? I build my own php forms so I'd appreciate it if you wouldn't suggest an online form maker or generator, I love having my site being built solely by me.
What you want to use is Javascript to do some client side checking before the user can click a submit button. This W3 Schools link has pretty much the exact example that you are looking to implement:
2007-05-01 10:55:47
·
answer #1
·
answered by Jim Maryland7
·
1⤊0⤋
what's to be wondered is the technique of allowing those women to construct their shallowness, conquer their insecurities and kind supportive courting. Can or might want to someone be the pioneer. I actually have seen you Tyra do it on your first teach (the females camp you began contained in the States) I seen in Malaysia. even even though it develop into in the back of agenda with the help of months i develop into enthralled with the help of the prospect of having the ability to help the females you meant by your own way. and that i'll assert it back: "What are the ability accessible for some communities to help those women?" we are all born with a purpose in this international, abilities, recommendations, strengths and weaknesses. The media does undesirable harm to youthful impressionable minds. although, I actually have talked about those days that there are extra classified ads and extra idols being advertised that are not any more the twiglet skinny form. that is a good commence yet we favor even extra range in that aspect. the mission with the media is they don't let human beings see the reality purely the completed product .. those so reported as fashions have flaws a twin of honestly everyone.
It depends on what you're using to handle the form data. Form handling scripts allow you to put a hidden field called 'required' and list the fields that you want to be required. Like this:
////////////////////////////////////////////////////////////////////////////////////////////
script type="text/javascript">
function ok() {
if(document.myform.foo.value.length > 0)
return true;
} else {
alert('You must include Foo');
document.myform.foo.focus();
return false;
}
}
name="myform">
Foo:
...
This could be enhanced with some additional checks for the value, e.g. for complying with some specific format (like letters only, or whatever). Note that the attribute value="" is there to make it explicit and sure that the field's initial value is empty and not just undefined. (Probably most browsers use empty initial value anyway, but personally I feel more comfortable when I've made it sure. :-) )
//////////////////////////////////////////////////////////////////////////////////////////////
Make a form field required
In this example I will show you how to make a form field required before allowing it to be processed. In this example we will use a self submitting form using a case statement.
Dim Variable name '(ShowAction)
ShowAction = Request.QueryString("action")
'QueryString (what shows in the address of bar) exampe.asp?action=show&error="&strerr&""
Key componets of a Case statement
Select Case ShowAction
Case ""
...
'Show Form
...
Case "show"
'process form
...
'end of process
End Select
According to how the fields are entered the following is processed.
if strerr = "1" then
response.write "Please fill in the field!"
end if
if strerr = "2" then
response.write "Please fill in the field!"
end if
if strerr = "3" then
response.write "Please fill in the field!"
end if
When the form is being processed then the following will be applied
if strfname = "" and strlname <> "" then
response.redirect "example.asp?error=1"
end if
if strfname <> "" and strlname = "" then
response.redirect "example.asp?error=2"
end if
if strlname = "" and strfname = "" then
response.redirect "example.asp?error=3"
end if
If both fields are enter then strerr will = blank and then process the rest of the form and give you your results.