Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default How does zen_set_field_length() work?

    It would seem there's a problem by specifying the length while using textboxes and textarea windows. When I modify the value in my templates, the size doesn't change for the width but only for the height.

    This morning, I have received a PM regarding this problem as it would seem that I'm not the only one encountering this problem. Perhaps this issue has been reported before but, after seeking for the topic from the forum's search engine, I couldn't find any results regarding this subject.

    (Zen-Cart - v1.3.0.2)
    Last edited by TheOracle; 10 Jul 2006 at 02:44 PM.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Bug] - zen_set_field_length module.

    Quote Originally Posted by TheOracle
    It would seem there's a problem by specifying the length while using textboxes and textarea windows. When I modify the value in my templates, the size doesn't change for the width but only for the height.
    1. "modify the value in my templates" .... the whole idea of zen_set_field_length() is to NOT set a width in the template, but to pull it from the database.

    2. TEXTAREA fields are typically related to "TEXT"-type database fields, and thus the zen_set_field_length() function would return a short value, since a TEXT field in the database has no "length" parameter. Thus, the use of the zen_set_field_length() function would usually not be encouraged for form fields related to TEXT database fields.

    3. Occasionally, certain database engines do not return accurate meta-data info such as field length, which I "think" is related to a security/permissions setting at the database-level and not something easily "guessed" by the function while querying the database.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: [Bug] - zen_set_field_length module.


    Thus, the use of the zen_set_field_length() function would usually not be encouraged for form fields related to TEXT database fields.
    Strange. From includes/templates/template_default/tpl_account_edit_default.php file, I found this result (originally from the downloaded package - unmodified):

    PHP Code:
    <?php echo zen_draw_input_field('customers_referral'''zen_set_field_length(TABLE_CUSTOMERS'customers_referral'15), 'id="customers-referral"'); ?>
    The zen_set_field_length is actually used with the zen_draw_input_field function. I have received a PM regarding this page, also, particularly (which has this reported problem). If I understand correctly, these two functions should not be related together ? If not, what would be the proper replacement ?

    Then, from admin/includes/modules/document_product/collect_info_metatags.php file, I found this result:

    PHP Code:
    <?php echo zen_draw_input_field('metatags_title[' $languages[$i]['id'] . ']', (isset($metatags_title[$languages[$i]['id']]) ? stripslashes($metatags_title[$languages[$i]['id']]) : zen_get_metatags_title($pInfo->products_id$languages[$i]['id'])), zen_set_field_length(TABLE_META_TAGS_PRODUCTS_DESCRIPTION'metatags_title''150'false)); //,'id="'.'metatags_title' . $languages[$i]['id'] . '"');?>
    From includes/templates/template_default/tpl_password_forgotten_default.php file, I found this result:

    PHP Code:
    <?php echo zen_draw_input_field('email_address'''zen_set_field_length(TABLE_CUSTOMERS'customers_email_address''40') . ' id="email-address"') . '&nbsp;' . (zen_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="alert">' ENTRY_EMAIL_ADDRESS_TEXT '</span>'''); ?>
    Would these, also, require modifications ?
    Last edited by TheOracle; 10 Jul 2006 at 04:39 PM.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Bug] - zen_set_field_length module.

    Okay ... let's look at the zen_set_field_length() results on your server .... What value is it returning for those fields?

    Does it do the same if you check the same page on several other servers?

    I suspect the problems you're encountering are related to my 3rd point about differences in supplying meta-data due to varying server configurations.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: [Bug] - zen_set_field_length module.

    Supposing it's condition no. 3, what would I need to look for on my server configuration in order to be more adaptive with the Meta-tags modules ?

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Bug] - zen_set_field_length module.

    How about post a link to techsupp.php for both servers you're aware of which are having this problem. .... or better yet, supply a detailed list of similarities between the servers where this is not working right vs another server that "is" working right.

    Also, need to look at what rights are granted to the MySQL user in each case.... is it "ALL" rights, or is it selectively granted only certain specific rights?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: [Bug] - zen_set_field_length module.


    Also, need to look at what rights are granted to the MySQL user in each case.... is it "ALL" rights, or is it selectively granted only certain specific rights?
    I believe they're actually under specific rights. Would that provoque an impact over zen_set_field_length ?

    Since, when I use other PHP scripts, I can easily use arrays that allows me to gather the right length value.

    For instance;

    PHP Code:
    $setting['length_size'
    I can call it under an HTML Form without any problems. Let's buld an example:

    PHP Code:
    <FORM action="http://www.mysite.com/file.php" METHOD="post">
    <input type="hidden" name="action" value="test">
    <input type="text" name="test_field" size="<?php echo $setting['length_size']; ?>">
    </form>
    Then, when I refresh my page, I can actually see that the size has changed.

    Althought, when I properly use the zen_set_field_length module over Zen-Cart, I modify the value number (under the parenthese) and the value does show differently (from view-source). Althought, the textarea, for instance, does not expand further when I increase the value. This is what it is all about actually.

    I'm trying to see if there's a modulation handling error from zen_set_field_length under includes/functions/functions_general.php file but I'm not that good to work under these types of functions.

    I just wish there was, actually, a way to make the transcription work correctly once we, either, increase or decrease the numeric value under that module. Unfortunitely, others, (not alot but a few), has also reported this problem as I thought I was the only one encountering it. Quite strange.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Bug] - zen_set_field_length module.

    Quote Originally Posted by TheOracle
    the textarea, for instance, does not expand further when I increase the value. This is what it is all about actually.
    okay.

    The function works this way:

    zen_set_field_length($tbl, $fld, $max=70)

    1. the database is checked to see what the defined maximum length of the field is in the table
    2. the result is compared with the "max" value passed (default = 70)
    3. If the field in the database is longer than the "max" value supplied as 3rd parameter in zen_set_field_length(), then the maximum is used.
    If the database field is shorter, the shorter value is used.

    If you wish to override it completely and set your own width regardless of the database settings, substitute the PHP for the relevant HTML, like this:
    PHP Code:
    zen_set_field_length(abc
    becomes this:
    PHP Code:
    size="46" maxlength="45" 
    (46 for size, and 45 for max, adding 1 extra char position for visibility reasons)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: [Bug] - zen_set_field_length module.

    My first general function lesson.


    2. the result is compared with the "max" value passed (default = 70)
    Is there a specific reason why the value should be set to a maximum value of 70 ? And ... technicly ... why 70 ? Is there a specific purpose for setting this value particularly ?

    As for this one:


    (46 for size, and 45 for max, adding 1 extra char position for visibility reasons)
    Yes, I agree. However, if I do choose to specify these length size manually, it will affect my HTML form presentation itself or it doesn't really matter ?

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Bug] - zen_set_field_length module.

    70 is the default if nothing is specified when you use the zen_set_field_length() function. Very seldom is the default used for this. I think 70 was selected because it's a logical maximum for not-to-long-but-not-too-short. Not sure. Doesn't really matter: just set a reasonable max when you use it.


    Your original post suggested that you were wanting to control the width of fields by manually coding a different number in the function. Since you are desiring to override the use of the function and set an explicit width, I don't see the point of your last question.
    My suggestion of 45 was just an example. Use whatever you desire in each case where you wish to accomplish something other than what the default template does.


    Alternatively, if it's only specific TEXTAREA fields that you want to control width for in order to set to a certain size, you can use the stylesheet instead. Beware of some cross-browser inconsistencies when setting widths for textarea fields via CSS. Test, test, test.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. How does it work?
    By Bridy in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 19 Jan 2008, 05:13 AM
  2. How does it work
    By melkor in forum General Questions
    Replies: 3
    Last Post: 4 Nov 2007, 07:18 PM
  3. zen_mail - How does it work?
    By cmessa in forum General Questions
    Replies: 6
    Last Post: 25 Apr 2007, 03:25 AM
  4. How does Referral work?
    By dealbyethan.com in forum General Questions
    Replies: 0
    Last Post: 11 Apr 2007, 02:56 AM
  5. how does egold work?
    By tekram in forum Addon Payment Modules
    Replies: 0
    Last Post: 28 May 2006, 07:19 AM

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