nvbenterprises Posted March 4, 2007 Posted March 4, 2007 I was just seeing if anyone could lead me in the right direction. I have added a few fields to my contact_us.php page. Phone number, city, state, etc. I have been trying to make a few of them required fields. The only field that remains to be required is the email field for obvious reasons. I have tried editing my english.php file, my english.php file in admin, to add new errors for the new fields, but it did not do the trick. I was slightly off on the tweak and nothing occurred. I did finally get an error message I was looking for, but it only came up if I hadn't filled in the email field. In other words, it still lets someone contact me whether or not they fill in the other fields. I think I just need to mod the contact_us code, however I am usually wrong about these things. I think this is the section of code: tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } } I don't know what kind of error I should have in here. Will a minimum character error work? I assume it could look something like this: tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } else { $error = true; $messageStack->add('contact', ENTRY_NAME_ERROR); } } Another problem is that many of these values (such as number of characters) are controlled in the admin. I was hoping to create a self service and bypass admin. Thanks
Guest Posted March 4, 2007 Posted March 4, 2007 I was just seeing if anyone could lead me in the right direction. I have added a few fields to my contact_us.php page. Phone number, city, state, etc. I have been trying to make a few of them required fields. The only field that remains to be required is the email field for obvious reasons. I have tried editing my english.php file, my english.php file in admin, to add new errors for the new fields, but it did not do the trick. I was slightly off on the tweak and nothing occurred. I did finally get an error message I was looking for, but it only came up if I hadn't filled in the email field. In other words, it still lets someone contact me whether or not they fill in the other fields. I think I just need to mod the contact_us code, however I am usually wrong about these things. I think this is the section of code: tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } } I don't know what kind of error I should have in here. Will a minimum character error work? I assume it could look something like this: tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } else { $error = true; $messageStack->add('contact', ENTRY_NAME_ERROR); } } Another problem is that many of these values (such as number of characters) are controlled in the admin. I was hoping to create a self service and bypass admin. Thanks Could something similar to this help? if (strlen($_POST['email_address']) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_ERROR); } else { // Do whatever with the email_address $email_address = tep_db_prepare_input($_POST['email_address']); } Regards, *Ringo*
nvbenterprises Posted March 4, 2007 Author Posted March 4, 2007 Thanks, That will help. It gives me the new error: 'Error Your E-Mail Address must contain a minimum of 6 characters.' I'll just need to modify it a little and hopefully I'll get to what I need for a new field. I'll check over the create_account.php file a little more and see where it leads me. And while I was posting...I realized that if I directly pasted some items from create_account.php file such as: if (strlen($city) < ENTRY_CITY_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_CITY_ERROR); } It will give me the error: Error Your City must contain a minimum of 3 characters. Perfect! Now I just need to figure out how to add a new field to the mix such as Organization Name, Products Interested In, Time frame, etc. These fields are defined in admin controls, so I need to add a field to the control. I do not know what file to modify, and have tried before, but failed. I assume to add a field to minimum values page I need to edit either english.php or index.php, but this didn't work last time, I will try and post later.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.