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
    58,249
    Blog Entries
    3
    Plugin Contributions
    106

    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!
    Donations always welcome: www.zen-cart.com/donate

    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
    250
    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.

 

 

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
  •