Jump to content

making Contact_Name a required field


Chrisj

Recommended Posts

I have this Form that works successfully (I know it's not state-of-the-art).
I simply want to add code to make Contact Name field mandatory.

I'm not sure if I should post all the code. Can you help me? thanks
 

<script type="text/javascript">
function checkemail(){
var str=document.myform.email_address.value;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if (filter.test(str))
testresults=true;
else {
alert("Please input a valid email address!");
return false;
}
if(document.myform.agree.checked!=1) {
alert("Please check the box to agree to the Terms.");
return false;
}
if(document.myform.ans.value.toLowerCase()!="white") {
alert("Please answer security question correctly: Black or White?");
return false;
}
return true;
}
</script>

 


 

Link to comment
https://forums.phpfreaks.com/topic/275818-making-contact_name-a-required-field/
Share on other sites

You need to add the code to your javascript.

 

If you don't know how to write javascript, you need to either learn or hire someone to do it.

If you make an effort, we can help you debug it. But you haven't written any code for this problem.

That's a lot more complex than your original requirement. Making a field required is not the same as validating the value within in. A contact name also sounds to me a different thing than a username. *shrug* If you can't explain what you want it's not surprising you can't get it done.

That will probably be the end of your replies.  Id listen to Jessica as being a Guru, she knows her stuff.  Best to learn and then post code you havent found else where or at least understand slightly yourself.  Just stick to php form validation to start with then make it more fancy once it works

 

however

 

http://lmgtfy.com/?q=jquery+form+validation

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.