Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2008
    Posts
    133
    Plugin Contributions
    1

    Default How to force selection of a checkbox?

    I know the "trick" for forcing selection of one of several radio buttons (make an additional one named "please select", mark it display only, and make it the default as explained here: http://www.zen-cart.com/forum/showthread.php?t=95520)

    However, this same thing does not work for checkboxes, not in the same way.

    I want to have 5 checkboxes for the user to indicate which of several models of a product they may own. They can specify more than 1, but they must at least pick 1.

    So if I try the "trick" method above, it will not force the user to pick one; the product will be added to the cart, and then the cart will say that invalid options have been selected and you need to go back and fix them. It doesn't tell you what is wrong specifically. This is much worse than what happens with the radio buttons or drop downs, where it will not allow you to add the product to the cart and it tells you exactly which option needs to be selected.

    I suspect that this will not work due to the nature of checkboxes, and if so, any hints on where to modify the code to fix this would be helpful.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: How to force selection of a checkbox?

    At this time, there isn't a way to force a selection on the checkboxes ...

    This is something we are looking into for a future release ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Apr 2008
    Posts
    133
    Plugin Contributions
    1

    Default Re: How to force selection of a checkbox?

    I had a feeling you were going to say that. ;)

    I hope when you are working on this, you all will consider a redesign of the way this whole issue works, with regards to any type of option selection. The rigamarole that people have to go through to get this to work on radio buttons and drop downs is very klugey (as discussed in the thread referenced above.)

    By way of example, I am moving to using ZC from having used MIVA for a store for many years. The way they do it is quite elegant and you should use it as some sort of a model.

    Basically, there is a setting for an attribute named "required". If you check "required", then the user is forced to make a selection, regardless of what type of UI object it is. You can specify one of the options to be the default, and in that case, the default is pre-selected unless the user chooses something else. But ticking the "required" setting on the attribute controls the whole behavior - no need to make extra option values and try to hide them (as discussed in the thread referenced above.)

    In your case, it seems this would be a setting in the Option Names section. You simply tick the "required" checkbox on the option name, and it then will not allow the user to add the item to the cart without making a selection of one of the option values (or one or more, in the case of a group of checkboxes in the same attribute.)

    Thanks!

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: How to force selection of a checkbox?

    Thanks for the suggestion ...

    We know that this is lacking in the attributes and do plan to address it in a future release as, quite frankly, the dang thing drives us nuts as well ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. v139h zen_draw_checkbox_field - how do I get my custom field to show selection in checkbox?
    By johnlewisdesign in forum Customization from the Admin
    Replies: 2
    Last Post: 1 May 2012, 03:12 PM
  2. Force Template Selection
    By philip937 in forum General Questions
    Replies: 2
    Last Post: 30 Aug 2011, 08:37 AM
  3. CheckBox Maximum Selection
    By phoenix80 in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 16 May 2011, 09:33 AM
  4. Force attribute selection?
    By jenpen in forum Setting Up Categories, Products, Attributes
    Replies: 10
    Last Post: 28 Jan 2011, 12:18 AM
  5. Force Selection of an Attribute
    By FoodDudes in forum General Questions
    Replies: 1
    Last Post: 22 Feb 2009, 03:53 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