Zen Cart Logo
Forums / General Questions / How to make an account signup field required

How to make an account signup field required

Views: 681

Results 1 to 5 of 5
19 Jul 2015, 5:00 PM
#1
textileinnovations avatar

textileinnovations

New Zenner

Join Date:
Jun 2006
Posts:
8
Plugin Contributions:
0

How to make an account signup field required

I have found many references regarding making a field a required field, however, I have not been able to accomplish this using any of the ideas I have found here. The "solutions" noted here have been vague and none specific. The closest I have got to finding where the solution might be located is noted below. If any one could help me with this it would be greatly appreciated. I am trying to change the a Company field on my account signup page to be a required field.

I found this code area I thought might be the area to edit. The email field is a required field, the code is shown and is quite different from the ACCONT_COMPANY code. Perhaps someone smarter than I could figure out how to do this.

INCLUDES/MODULES/PAGES/CREATE_ACCOUNT/jscript_form_check.php

<?php if (ACCOUNT_COMPANY == 'true' && (int)ENTRY_COMPANY_MIN_LENGTH != 0) echo ' check_input("company", ' . (int)ENTRY_COMPANY_MIN_LENGTH . ', "' . ENTRY_COMPANY_ERROR . '");' . "\n"; ?> <?php if ((int)ENTRY_EMAIL_ADDRESS_MIN_LENGTH > 0) { ?>

check_input("email_address", <?php echo (int)ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>, "<?php echo ENTRY_EMAIL_ADDRESS_ERROR; ?>");

<?php } ?>
19 Jul 2015, 5:42 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: How to make an account signup field required

To make the "Company" field required at account creation, simply change the value in your admin's Configuration->Minimum Values->Company to a value greater than 0 (the default, upon installation).

19 Jul 2015, 9:29 PM
#3
textileinnovations avatar

textileinnovations

New Zenner

Join Date:
Jun 2006
Posts:
8
Plugin Contributions:
0

Re: How to make an account signup field required

Thanks, I guess I was over-thinking this. I did have the min. set at 6. I was expecting a red asterisk to show up denoting that it was now required. Without the asterisk people will have to go back and enter the data when the Popup tells them they missed it. Maybe when a number > 0 is used a red asterisk should also appear to have continuity with the other required fields.

Cheers
James

19 Jul 2015, 10:26 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: How to make an account signup field required

textileinnovations:

Thanks, I guess I was over-thinking this. I did have the min. set at 6. I was expecting a red asterisk to show up denoting that it was now required. Without the asterisk people will have to go back and enter the data when the Popup tells them they missed it. Maybe when a number > 0 is used a red asterisk should also appear to have continuity with the other required fields.

Cheers
James

That is the general expectation and unfortunately is/has been missing from some of the fields and in some cases will remain visible even when it appears that the "required" field is no longer required... :) not difficult to correct but is something that unfortunately tends to need that correction...

20 Jul 2015, 11:37 AM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: How to make an account signup field required

textileinnovations:

Thanks, I guess I was over-thinking this. I did have the min. set at 6. I was expecting a red asterisk to show up denoting that it was now required. Without the asterisk people will have to go back and enter the data when the Popup tells them they missed it. Maybe when a number > 0 is used a red asterisk should also appear to have continuity with the other required fields.

Cheers
James
There was a discussion a couple of years ago regarding automating the required fields. For right now, you can edit your template's version of your store's main language file; if you don't have the file /includes/languages/YOUR_TEMPLATE/english.php currently, copy /includes/languages/english.php to that subdirectory first. Change the line that reads:

  define('ENTRY_COMPANY_TEXT', '');

to the following:

  define('ENTRY_COMPANY_TEXT', ((ENTRY_COMPANY_MIN_LENGTH > 0) ? '*' : ''));

That change will set the "required" indicator for the company field if the company field's minimum length is greater than 0.