Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: Custom form doesn't work

    Quote Originally Posted by Dave224 View Post
    Many thanks to everyone who has helped me with this form problem. The form is basically working and the input data processed correctly. I'm now cleanup a few loose ends. When the form is first displayed, an input field is displayed just below the dropdown state menu. But in the create account form, from which I based my custom form on, the unlabeled input box is not displayed. The following code from tpl_modules_create_account.php addresses the area of the form in question.
    Code:
    <?php
      if (ACCOUNT_STATE == 'true') {
        if ($flag_show_pulldown_states == true) {
    ?>
    <label class="inputLabel" for="stateZone" id="zoneLabel"><?php echo ENTRY_STATE; ?></label>
    <?php
          echo zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($selected_country), $zone_id, 'id="stateZone"');
          if (zen_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="alert">' . ENTRY_STATE_TEXT . '</span>';
        }
    ?>
    
    <?php if ($flag_show_pulldown_states == true) { ?>
    <br class="clearBoth" id="stBreak" />
    <?php } ?>
    <label class="inputLabel" for="state" id="stateLabel"><?php echo $state_field_label; ?></label>
    <?php
        echo zen_draw_input_field('state', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state" placeholder="' . ENTRY_STATE_TEXT . '"');
        if ($flag_show_pulldown_states == false) {
          echo zen_draw_hidden_field('zone_id', $zone_name, ' ');
        }
    ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    I can see no way of not executing the code in red and displaying an input field. But when creating an account the input field is not shown and in my custom form code with the same code, the input field is shown. I've compared the code in both places, forced the variables entering the code to be identical, and the result is the same. Help!

    TIA,
    Dave
    Ready for the "torture"? :) that field is there to support the ability of manually entering the information but it's visibility is routinely controlled by the javascript found in the associated includes/modules/pages/THAT_PAGE directory typically by the name of jscript_addr_pulldowns.php. But, that is only of value when the zone list is drawn using the associated javascript function: zen_js_zone_list and a few other related dependencies... so the question kind of becomes, do you need to have all of that capability (zone selection basically) or is this added options that are unnecessary? The fact that the label is empty/blank means that the variable $state_field_label is not populated or possibly not even defined. The later can be an issue in future php versions...

    So, if not already done, recommend copying over the jscript_add_pulldowns.php file from the associated source folder (create_account) which should resolve the field presence/omission issue.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #12
    Join Date
    Jun 2012
    Posts
    407
    Plugin Contributions
    0

    Default Re: Custom form doesn't work

    The javascript code was copied over to the new page. I discovered by accident that if I change the country to something else and then back again, the field is not drawn. So I conclude the problem is something with the update_zone function in jscript_addr_pulldowns.php or the variables passed to it.

  3. #13
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: Custom form doesn't work

    Quote Originally Posted by Dave224 View Post
    The javascript code was copied over to the new page. I discovered by accident that if I change the country to something else and then back again, the field is not drawn. So I conclude the problem is something with the update_zone function in jscript_addr_pulldowns.php or the variables passed to it.
    Have you tried checking the console for any javascript errors? My guess is that there is reference to field, I think called stText, that is referenced upon which to take action that is not actually present on the page and is not verified to be present as part of the action. (this was an issue brought up by I think torvista, but I could be wrong on the individual).
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #14
    Join Date
    Jun 2012
    Posts
    407
    Plugin Contributions
    0

    Default Re: Custom form doesn't work

    No javascript errors when I bring up my custom form with the state field box displayed. If I change the country and then go back to the original country I still get no errors.

    Interestingly, when bringing up the create account form, there is a javascript error "Type Error Cannot set property of 'classname' in Null" with a traceback to
    Code:
    document.getElementById("stText").className = 'hiddenField';
    in function hideStateField. If I change the country, I get the same error except the traceback goes to function showStateField. If I return to the original country, the same error occurs but back to function hideStateField.

    I've read the bug reports 220483 and 220483.

    The corrections in the latter link are all in place in jscript_addr_pulldowns.php files for the create account page and the custom page.

  5. #15
    Join Date
    Jun 2012
    Posts
    407
    Plugin Contributions
    0

    Default Re: Custom form doesn't work

    Found the problem. The on_load.js file was pointing to the create_account page instead of the new custom page. So the initial processing of the state field box was never performed. It all works as I want now, and consistently with create account.

    I have learned so much from mc12345678, lat9, dr.byte, swguy, and many others over the years. Thanks again. Another donation is on the way.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v154 The Contact Us Form Doesn't appear
    By sapir39 in forum General Questions
    Replies: 2
    Last Post: 3 May 2015, 02:39 PM
  2. Replies: 3
    Last Post: 30 Jun 2011, 04:41 PM
  3. My form submit button doesn't work
    By timjbart in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 21 Aug 2008, 11:25 PM
  4. My contact us form doesn't work...
    By bubblegumgoods in forum General Questions
    Replies: 24
    Last Post: 14 May 2006, 01:58 AM
  5. The Contact Us form...doesn't!
    By paults in forum General Questions
    Replies: 7
    Last Post: 10 May 2006, 03:22 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