Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2007
    Posts
    112
    Plugin Contributions
    0

    Default Is it possible to have a default value in text attributes?

    One site we developed uses attributes to gather info from the customer as they order. All attributes are set at "required", and this works flawlessly ... except sometimes. I think those "sometimes" are when the customer just inputs a "space" in the box.

    So, is there any way to have a default value show in the text box, like maybe a question mark, although anything would do. The reason this is so important is because we use the Export Shipping Info mod to download orders to Excel, then run it through a complicated conversion macro to separate the attributes into individual cells. The problem is the macro doesn't work correctly if any of the text boxes are blank. At least if there were a ? or something in the box, all would work fine.

    Any and all ideas on this would be most appreciated, whether they help us fix the text box issue or fix the Excel conversion to work with spaces. Thanks!
    RAB

    Why is it I'm always surprised when something actually works?

  2. #2
    Join Date
    Nov 2007
    Posts
    12
    Plugin Contributions
    1

    Default Re: Is it possible to have a default value in text attributes?

    It doesn't appear that a default field for text attributes exist. I've made some code changes to my site to allow for this. It involves creating a new DB field, adding a "Default text" field, then the changes needed to read from the textarea and get it into the DB. It's not a difficult change, but it's not exactly trivial either.

    Maybe there's something in the contributions directory? I'd post my code, but it's not exactly "contribution" ready, and there appears to be no other forums available to do this sort of thing (i.e., posting of beta code, mods, etc.). If it's not a pressing need, I can share my mods with you offline.

  3. #3
    Join Date
    Sep 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: Is it possible to have a default value in text attributes?

    Hi Brianko,
    do you still have that piece of code?
    Thanks

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Is it possible to have a default value in text attributes?

    You would need something to then process the text to check for the question mark ...

    You could customize the functions_lookups.php and alter the code to meet the needs of no spaces can be used:
    PHP Code:
    // text required validation
        
    if (ereg('^txt_'$option)) {
          
    $check_attributes $db->Execute("select attributes_display_only, attributes_required from " TABLE_PRODUCTS_ATTRIBUTES " where products_id='" . (int)$product_id "' and options_id='" . (int)ereg_replace('txt_'''$option) . "' and options_values_id='0'");
    // text cannot be blank
          
    if ($check_attributes->fields['attributes_required'] == '1' and empty($value)) {
            
    $check_valid false;
          }
        } 
    Tidy up the $value in there before the test is done ...
    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: v1.5.5]
    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!

 

 

Similar Threads

  1. v139h Field doesn't have a default value
    By JoshS in forum General Questions
    Replies: 1
    Last Post: 13 Jul 2016, 04:29 PM
  2. 1364 Field 'query_keys_list' doesn't have a default value
    By geekgirl in forum Upgrading from 1.3.x to 1.3.9
    Replies: 3
    Last Post: 13 Apr 2009, 12:54 AM
  3. BLOB/TEXT column 'products_options_values' can't have a default value ??
    By quantumfusion in forum Installing on a Windows Server
    Replies: 16
    Last Post: 26 Jan 2008, 01:40 AM
  4. 1101 BLOB/TEXT column can't have a default value
    By tkroh in forum Installing on a Windows Server
    Replies: 3
    Last Post: 27 Dec 2006, 10:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR