|
Author |
Message |
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Oct 27, 2002 12:58 am (21 years, 6 months ago) |
|
Hi,
Is there any way that I can make FormMail send an IP address with the mail it sends to the recipent when it is filled in.
Also is there a way I can make the email field compulsary on a feedback form such as the one I am using at http://www.bluesweb.co.uk/forms/feedback.php, IE so if you leave the email field blank it doesn't let you send the form?
Thanks! |
|
|
|
|
Darren
Team Member
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sun Oct 27, 2002 1:14 pm (21 years, 6 months ago) |
|
I assume you want something in Javascript for the validation. Someone wrote this for me once, which might do the trick. Could be much simpler for just one field.
Stick this in the head
Code: | <script language="JavaScript">
<!--
function validateForm() {
var warning = "";
if(document.frm.name.value == "") {
warning = "\nName";
}
if(document.frm.email.value == "") {
warning += "\nE-mail address";
}
if(document.frm.address.value == "") {
warning += "\nAddress";
}
if(document.frm.postcode.value == "") {
warning += "\nPostal Code";
}
if(document.frm.fax.value == "") {
warning += "\nFax";
}
if(document.frm.tel.value == "") {
warning += "\nWork/Home number";
}
if(warning != "") {
alert("You must fill in the following fields:\n" + warning + "\n\nPlease try again.");
} else {
document.frm.submit();
}
}
//-->
</script> |
This is the form
Code: | <form name="frm" method="post" action="">
<input type="text" name="name" class="forms" size="30">
<input type="text" name="email" class="forms" size="30">
<textarea name="address" class="forms" cols="30" rows="4" wrap="VIRTUAL"></textarea>
<input type="text" name="postcode" class="forms" size="30">
<input type="text" name="tel" class="forms" size="30">
<input type="text" name="fax" class="forms" size="30">
<input type="submit" name="Submit" value="Submit" class="forms" onClick="validateForm();return false;">
</form> |
Of course it only checks that the fields aren't empty. |
|
|
|
|
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Oct 27, 2002 3:52 pm (21 years, 6 months ago) |
|
Cheers Darren, I'll try that when I get a minute! |
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Tue Oct 29, 2002 6:43 pm (21 years, 6 months ago) |
|
just a note about relying on JavaScript to validate forms...while it may be quicker than submitting and waiting, it can be easily by-passed...
also: what if the user doesn't support JavaScript? or has it turned off for some reason? the form won't be validated...I suggest using php instead. |
________________________________ It's turtles all the way down... |
|
|
|
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Mon Nov 25, 2002 6:00 pm (21 years, 5 months ago) |
|
Justin wrote: | Is there any way that I can make FormMail send an IP address with the mail it sends to the recipent when it is filled in. |
Anyone? |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Mon Nov 25, 2002 7:13 pm (21 years, 5 months ago) |
|
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.144124 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |