Jump to content



Photo
- - - - -

Making required fields not required


This topic has been archived. This means that you cannot reply to this topic.
23 replies to this topic

#1   BlasphemousMusic

BlasphemousMusic
  • Members
  • 10 posts

Posted 19 February 2004 - 23:18

All I need to do, which I cannot figure out, is to take the red * off the fields and also make some of the fields optional and not required. I have searched for hours on end for solutions to this and the only one I have found so far said to edit the customer details. But the fields have all ready been set to false and will not update correctly. I am selling items which do not require any shipping, and adress will be located in paypal, so please please for the love of... someone direct me to the right place or tell me which line of code to edit. I have been in create_account.php and the only thing I was able to do was completely take it off the registration of a new account. I don't want that I just want them like I said to be optional and still be able to create an account with or without these fields. I thank you greatly in advance!!!!

-jim

#2   TerryK

TerryK
  • Members
  • 1,359 posts

Posted 20 February 2004 - 06:25

Okay, in create_account.php, you'll see text that looks like this for those fields that are marked as required -- in this example, the 'City' field:

<?php echo tep_draw_input_field('city', '', 'size="30"') . '&nbsp;' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?>

This part of that code:

<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>

tells the script to look at this code in /catalog/includes/languages/english.php for the corresponding text. In that file, you'll find:

define('ENTRY_CITY_TEXT', '*');

Changing that code (obviously with all of the fields that you don't want flagged as required -- not just the 'City' example I'm giving) to:

define('ENTRY_CITY_TEXT', ' ');

should remove the 'required' reference from your pages.

HTH,

Terry
Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

Add order total to checkout_shipment
Add order total to checkout_payment
Add radio buttons at checkout_shipping (for backorder options, etc.)
Duplicate Table Rate Shipping Module
Better Product Review Flow

* If at first you don't succeed, find out if there's a prize for the loser. *

#3   misa

misa
  • Members
  • 169 posts

Posted 20 February 2004 - 10:57

Another question.......

How to put the telephone number on the e-mail confirmation send to me?

#4   osburn

osburn
  • Members
  • 1 posts

Posted 24 March 2004 - 14:57

Okay, in create_account.php, you'll see text that looks like this for those fields that are marked as required -- in this example, the 'City' field:

<?php echo tep_draw_input_field('city', '', 'size="30"') . '&nbsp;' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?>

This part of that code:

<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>

tells the script to look at this code in /catalog/includes/languages/english.php for the corresponding text. In that file, you'll find:

define('ENTRY_CITY_TEXT', '*');

Changing that code (obviously with all of the fields that you don't want flagged as required -- not just the 'City' example I'm giving) to:

define('ENTRY_CITY_TEXT', ' ');

should remove the 'required' reference from your pages.

HTH,

Terry

Okay,
I tried it your way and had success in removing the red stars.

But nevertheless, a popup-Window appears.
It insists that the fields must have a certain length, even one of 0!?

Any idea to work around that problem?

Thanks

#5   zricz

zricz
  • Members
  • 8 posts

Posted 28 March 2004 - 02:01

Removing the * from this script only removes the red mark from the laccount creation form.

It doesn't tell the script no to require it...

Here is the script;

define('ENTRY_CITY_TEXT', '*');

Any idea on how to make the telephone number not required ?

#6   mike s

mike s
  • Members
  • 52 posts

Posted 28 March 2004 - 02:10

in the database in table customers you need to edit the fields you want to not be required and set null to NO.....That will fix the required information...







Mike
Where support is key!

#7   zricz

zricz
  • Members
  • 8 posts

Posted 28 March 2004 - 05:22

either that or in the "set minimums" in the configuration area, you could just leave the minimum blank. If you set it to 0 , it won't work. it must be blank.

#8   Iyamcanadian

Iyamcanadian
  • Members
  • 4 posts

Posted 31 March 2004 - 07:31

Canna change gender to not required with "set minimums",

also where do I access the customer table to set to null to NO

TIA Doug

#9   gazzzzzza

gazzzzzza
  • Members
  • 267 posts

Posted 31 March 2004 - 14:58

You access the customer table via telnet or something like 'mysql front'.
You find your table (customers) and modify the columns that you want to change to be not null.

i wouldn't advise messing with this unless you know what you are doing though as it can damage your oscommerce system.

i just commented out the gender line so they cant enter a gender. that solves the prob!
always here to offer some useless advice....

#10   Urbluffingme

Urbluffingme
  • Members
  • 262 posts

Posted 31 March 2004 - 15:07

When I wanted to make a field that was required optional, I removed the " * " using the process above, and I just removed the validation function.

if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
      $error = true;

      $messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);
    }

This did it for me and it was pretty easy.

By the way, you also have to change account_edit.php the same way. Otherwise, if somebody tries to edit their account settings, they will then be required to submit all the information that you originally made optional.

#11   Sapro

Sapro
  • Members
  • 45 posts

Posted 13 April 2004 - 18:41

in the database in table customers you need to edit the fields you want to not be required and set null to NO.....That will fix the required information...

Mike

I'm banging my head against the wall on this one myself

I haven't messed with the database, but taking a peek show me that all fields in table "customers" under NULL are set to NO with the exception of

customers_fax
customers_newsletter

which are set to YES.

i just commented out the gender line so they cant enter a gender. that solves the prob!


I did that too... so now I have no "gender" field on the form, but it still tells me it's required!

Any other ideas?

#12   bluepony

bluepony
  • Members
  • 466 posts

Posted 13 April 2004 - 18:47

under NULL are set to NO


That means that Allow Nulls is NO for those items. If you want them to be able to leave it blank, set that field to YES for those items.
I'd rather be flying!

#13   Sapro

Sapro
  • Members
  • 45 posts

Posted 13 April 2004 - 18:50

That didn't fix it either. /sad.gif' class='bbc_emoticon' alt=':(' />

I should note, I'm specifically trying to remove the gender field, and to make date of birth optional.

I removed gender from the form, but it is still trying to validate it. I removed the * from DOB, and it is still trying to validate it.

I understand the * doesn't cause the validation, I'm just trying to be thorough in explaining my issue.

Edited by Sapro, 13 April 2004 - 18:52.


#14   bluepony

bluepony
  • Members
  • 466 posts

Posted 13 April 2004 - 19:06

Once you have set the NULL field to YES for the date of birth, then set the minimum value in the Admin for date of birth to blank in Admin/Configuration/Minimum Values. That should make it optional.

If it still does not work, you might just want to remove it completely by going to Admin/Configuration/Customer Details
I'd rather be flying!

#15   Sapro

Sapro
  • Members
  • 45 posts

Posted 13 April 2004 - 19:11

If it still does not work, you might just want to remove it completely by going to Admin/Configuration/Customer Details

DUH!

I think that was what I was looking for all along! Thanks a bunch!

#16   bluemoon

bluemoon
  • Members
  • 91 posts

Posted 24 April 2004 - 04:14

Help!!!

I followed the steps to remove the required field for the phone number and it worked.

However, IE 6 has been generating a syntax error message for line 116, character 28 in catalog/create_account.php.

So, I reinstalled the ORIGINAL files for catalog/create_account.php and it still shows the error message.

Then I reinstalled the original file for catalog/languages/english/create_account.php and it STILL shows the error message AND the missing asterisk after the phone number (which I removed).


Create Account page

Help! What am I missing????

#17   bluemoon

bluemoon
  • Members
  • 91 posts

Posted 25 April 2004 - 07:14

Sorry, Folks, but some of these things don't really work. Or they do, but they can generate errors in IE.

For example, you can't set the minimum field to 0 or a non-0 number without generating some type of error.

The best thing to do is to delete the Minimum requirement altogether by deleting all instances of the field from the database and PHP scripts.

There are references to the phone field and most other fields on 11 different pages! Or 7 pages if you only use english.

- account_edit.php - catalog
- create_account.php - catalog
- oscommerce.sql - catalog/install
- form_check.js.php - catalog/includes
- english.php - catalog/languages
- espanol ..
- german ...
- customers.php - catalog/admin
- english.php - catalog/admin/includes/languages
- espanol ..
- german ..

I am going to create a little helpful manual as I go along and will put the link to the guide in my signature file for easy reference.

#18   callenords

callenords
  • Members
  • 75 posts

Posted 21 February 2009 - 20:39

And how do I remove the required field "Country"? Where in the database?

Thanks!

Edited by callenords, 21 February 2009 - 20:40.


#19   Ninety-one Maro

Ninety-one Maro
  • Members
  • 49 posts

Posted 02 April 2012 - 12:01

Ok, on version 2.3.1. I cannot get the Telephone number to not be required. I have done what was asked here, and still no go. I have just gone and changed it to a minimum value of 3 digits, and still having issues.

How do you remove the telephone number from this???

#20   spooks

spooks
  • Members
  • 7,017 posts

Posted 02 April 2012 - 12:23

@Ninety-one Maro 3 means its still required, set to 0 for not required

The security add-on I did checks a phone number if given, then that it passes set params, if not provided ignored.
Sam

Remember, What you think I ment may not be what I thought I ment when I said it.

Contributions:


Auto Backup your Database, Easy way

Multi Images with Fancy Pop-ups, Easy way

Products in columns with multi buy etc etc

Disable any Category or Product, Easy way

Secure & Improve your account pages et al.