Jump to content

Email form issue. Not enforcing it.


tim_ver

Recommended Posts

I have this script now for one of my forms and when people use it they are putting in n/a or bobo.bob.com for email address so when I get the form I get in the from spot the hositing companies email and not the users name or email, how do I fix this so they must use a valid email format, and it puts what the use in the email line in the from spot?

 

Code:

<script type="text/javascript" language="javascript" charset="utf-8">

// <![CDATA[

function Check()

{

error = '';

if(document.frm.Email.value=='') { error += 'Email is required\n'; }

if(document.frm.Contact_Name.value=='') { error += 'Contact name is required\n'; }

if(document.frm.Contact_Phone.value=='') { error += 'Phone number is required\n'; }

 

if(error!=''){ window.alert(error); return false; }

return true;

}

// ]]>

</script>

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/44276-email-form-issue-not-enforcing-it/
Share on other sites

I did add this to it but not working. I need it to force users to enter a vaild email address in the email box.

 

<script type="text/javascript" language="javascript" charset="utf-8">

// <![CDATA[

{

error = '';

function Check()

function validate_Email(field,alerttxt)

{

with (field)

{

apos=value.indexOf("@")

dotpos=value.lastIndexOf(".")

if (apos<1||dotpos-apos<2)

  {alert(alerttxt);return false}

else {return true}

if(document.frm.Email.value=='') { error += 'Email is required\n'; }

if(document.frm.Contact_Name.value=='') { error += 'Contact name is required\n'; }

if(document.frm.Contact_Phone.value=='') { error += 'Phone number is required\n'; }

 

if(error!=''){ window.alert(error); return false; }

return true;

}

// ]]>

</script>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.