Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2008
    Location
    Uk
    Posts
    79
    Plugin Contributions
    0

    Default Make a Dropdown instead of Input field ?

    Hi, I've managed to get my added fields working perfectly but now i need to make them into dropdown's instead of a straight input field, I've looked at the, "State" dropdown in the login page and it seems like a million lines of code for one dropdown? Is there a better way to make a field into a dropdown ?

    Cheers
    J#XX
    (Scott Perry)

  2. #2
    Join Date
    Dec 2008
    Location
    Uk
    Posts
    79
    Plugin Contributions
    0

    Default Re: Make a Dropdown instead of Input field ?

    Hi, I was told on another forum to implement the following:

    <select name="myfield">
    <option selected>Option 1</option>
    <option>Option 2</option> etc..
    </select>

    Although it appears as it should how do I get the selected result to be stored in the database as it does with the zen_draw_input_field used by the majority of the login page ? Can anyone assist.

    Cheers
    J#xx
    (Scott Perry).

  3. #3
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Make a Dropdown instead of Input field ?

    The state field is a bad example to follow as it has some specific complciations.

    The result of your field will be passed to whichever page handles the inputs collected by your form in the variable $_POST["myfield"]

    It's not clear however from your post where your code to update the database would go, as you haven't said much about what you're doing, so it's unclear whether your data is truly being collected by the login page, or rather by the create_account module.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  4. #4
    Join Date
    Dec 2008
    Location
    Uk
    Posts
    79
    Plugin Contributions
    0

    Default Re: Make a Dropdown instead of Input field ?

    Hi and thanks for the reply !.

    I've made some extra fields replicating the (Fax Number) field to add extra information to the datebase from the create account page "tpl_modules_create_account". I also can edit these field in the account edit section of Zencart, "tpl_account_edit_default" and it also appears and can be edited from the "admin/customers.php". the collected data also appears in the invoice and packing slip pages. All was well until a higher power insisted that they become a dropdown instead of an input field.

    I thought that I could replicate the code from the Countries dropdown but without luck.

    Panic has set in ! How you guys know all this is beyond me, major respect !

    Any advice would be beneficial.

    Cheers

    J#xx
    (Scott Perry)

  5. #5
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Make a Dropdown instead of Input field ?

    If you already have this working for an input field, then merely inserting the HTML that you have been given for a drop down menu should work, as long as you use the same field name as you did for the input field, since when the data is received from the form, it will look identical whether it comes from an input form or a pulldown menu.

    The only wrinkle will be when you are maintaining it for the edit page. Then you would need to read the current value (as you probably do for the input field already) and mark the appropriate option as selected.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  6. #6
    Join Date
    Dec 2008
    Location
    Uk
    Posts
    79
    Plugin Contributions
    0

    Default Re: Make a Dropdown instead of Input field ?

    Hi, Ive noticed that the Zen way of doing things involves the zen_draw_pull_down request, and mine only has the, "select name" I would like to think that the option selected in the dropdown would be recorded into the database within the,"table_customers" field in Mysql but it won't as you say the problem would be on calling the stored data into any other request from the database. Why is it that when things work someone else always want's to bugger it ! My Boss !! arggh.

    I see that the Countries dropdown calls data from countries in mysql and displays it when needed. If I create a table called Sphere and one called Cyl etc. and point the modified dropdown to those tables could I use the code for the countries dropdown to record data in the tables that I need.

    Basically I need to collect the info, store it in table_customers and also have it snapshotted when orders are processed.

    If this is possible I would be willing to pay through the nose !

    Cheers
    J#xx
    (Scott Perry)

  7. #7
    Join Date
    Dec 2008
    Location
    Uk
    Posts
    79
    Plugin Contributions
    0

    Default Re: Make a Dropdown instead of Input field ?

    All working fine, thanks for the advice !

    Cheers
    J#xx

    (Scott Perry)

 

 

Similar Threads

  1. Make input field on collectinfo also display the field text as hyperlink
    By jpietrowiak in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 15 Dec 2012, 05:06 AM
  2. v139h Altering Quantity field from text input to dropdown on a per-product basis?
    By jgold723 in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 31 Aug 2012, 08:06 AM
  3. book author field in admin instead of dropdown list
    By joomdevz in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 15 Jul 2010, 11:55 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