Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2006
    Posts
    37
    Plugin Contributions
    0

    Default help, need custom dropdowns and checkboxes

    I have searched the forum, the wiki and gone to wit's end attempting to build my own drop down menu based on some of the recommendations I was able to find but apparently I am too dense to figure this out.

    I am trying to create some drop down form menus and checkboxes in a survey form. These drop downs will not need to make any calls to the database or write to the db. The form is to be emailed to the admin once it is filled out. The form is on its own page.

    I based my first attempts on DrByte's "band sign up" form but it has no drop down menus, check boxes or radio button examples. I could build this form with html but I would like to take advantage of zen-cart's built-in error handling.

    I have been trying to decipher the zen_draw_pull_down_menu and zen_draw_checkbox_field functions but do not have enough php skill (yet!) to figure out how to use them.

    Can someone help me with this or point me to a tutorial/explanation on how to implement these functions.

    Thanks,

    cpk

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

    Idea or Suggestion Re: help, need custom dropdowns and checkboxes

    Hopefully this will help get you started in the right direction:

    in your header_php.php, you need something like this:
    PHP Code:
    // do you want to set a default selection?  if not, use '0':
    $default_pulldown_selection '2';

    //For validation, you're looking for the contents of the $_POST['my_pulldown_menu'] variable
    // this is only set after "submit" is clicked.
    $pulldown_selected_item = (isset($_POST['my_pulldown_menu'])) ? $_POST['my_pulldown_menu'] : $default_pulldown_selection ;


    //build an array of entries to be displayed on the template:
        
    $pulldown_contents[] = array('id'=>'0''text'=>'Please Select');
        
    $pulldown_contents[] = array('id'=>'1''text'=>'Choice Number 1');
        
    $pulldown_contents[] = array('id'=>'2''text'=>'Choice Number 2');
        
    $pulldown_contents[] = array('id'=>'3''text'=>'Choice Number 3');
        
    $pulldown_contents[] = array('id'=>'4''text'=>'Choice Number 4');
        
    $pulldown_contents[] = array('id'=>'5''text'=>'Choice Number 5');


    // you could add some validation here.
    if ($pulldown_selected_item==0) { 
      
    $messageStack->add_session('header','Please select an option from the pulldown menu','error');


    In your template, display the contents:
    PHP Code:
    echo zen_draw_pull_down_menu('my_pulldown_menu'$pulldown_contents$pulldown_selected_item); 
    .

    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
    Dec 2004
    Location
    Stockholm
    Posts
    123
    Plugin Contributions
    0

    Default Re: help, need custom dropdowns and checkboxes

    This was nice ..
    Now I have to find out how Radio Buttons works in Zen..

    Asp :-D
    Employing version 1.3.X

  4. #4
    Join Date
    Mar 2006
    Posts
    19
    Plugin Contributions
    0

    Default Re: help, need custom dropdowns and checkboxes

    i used this method to create a dropdown menu but the pulldown_contents are not displaying. any suggestions?

  5. #5
    Join Date
    Jul 2006
    Posts
    248
    Plugin Contributions
    0

    Default Re: help, need custom dropdowns and checkboxes

    in your header_php.php, you need something like this:
    I'm confused. Is this in:

    /public_html/includes/templates/MYTEMPLATE/common

    Thanks.

 

 

Similar Threads

  1. Stuck on custom css and template mod need help
    By GoldBuckle in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 20 Apr 2012, 04:41 AM
  2. Need help adding new, special, and featured products to Home page on Custom Template
    By HipChickDesigns in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 23 Feb 2011, 08:21 PM
  3. Need Help.. add items with checkboxes instead of buttons
    By Pianomangigs in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 8 Feb 2010, 05:15 PM
  4. Re: Mixing Checkboxes and Text Fields?
    By thegoodlifestore in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 27 Jan 2009, 07:44 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