Forums / General Questions / Make company field as required.

Make company field as required.

Locked

Views: 2,439

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
11 Jun 2007, 11:48 AM
#1
arkangel avatar

arkangel

New Zenner

Join Date:
Mar 2005
Location:
United Kingdom
Posts:
29
Plugin Contributions:
0

Make company field as required.

Hi,

I tried to change the company field as required. I changed the code in includes/modules/pages/create_account/header_php.php from:
if (ACCOUNT_COMPANY == 'true') $company = zen_db_prepare_input($_POST['company']);

TO:
if (ACCOUNT_COMPANY == 'true') {
$company = zen_db_prepare_input($_POST['company']);
if (strlen($company) < 3) {
$error = true;
$messageStack->add('create_account', ENTRY_COMPANY_NAME_ERROR);
}
}

However, people still can submit the form without filling the company field. I also changed the minimum value in admin section from 0 to 3.
Can anybody help me to point out why this doesn't work? Am I missing something?

Thanks a lot!!

11 Jun 2007, 1:21 PM
#2
arkangel avatar

arkangel

New Zenner

Join Date:
Mar 2005
Location:
United Kingdom
Posts:
29
Plugin Contributions:
0

Re: Make company field as required.

I found the solution by myself. For those who have the same difficulty, go to includes/modules/pages/create_account/jscript_form_check.php and you can add the php check for ACCOUNT_COMPANY under function check_form(form_name) {} .

This will fix the problem. :)

11 Jun 2007, 5:03 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Make company field as required.

Thanks for the update on how you addressed this change ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

9 Aug 2007, 4:27 AM
#4
asajay avatar

asajay

New Zenner

Join Date:
Aug 2007
Posts:
1
Plugin Contributions:
0

Re: Make company field as required.

I also wish to make the company name a required field. I'm confused with this solution though. I don't know php so I'm not sure exactly what was done here to make it work. Here is what I -have- done:

  • edited english.php to make the * visible
  • gave a minimum value to company name of 1 (which appears to have made it required on account creation0

But now here is my problem.
If a person then goes to edit their address details, the Company name is still listed as a required field but is no longer filled in with any info. The name, address and other fields are populated, but the company name is not. If the user clicks to update, then the company name disappears.

So my problem is, Company name is being required on account creation, but on address update it is blanking the field and not actually requiring it. Seems like a bug to me. What am I missing?

Thanks,
Asa Jay