AeroLogistica Posted March 23 Share Posted March 23 (edited) Hello fellow geeks! So I have 5 options with numbers 1-70 and one additional option where the customer must select one number 1-25. So, for the first 5 options, the customer cannot select the same number twice, for example, he can choose 4-9-26-7-10 but he cannot choose 4-9-26-7-4-10. Then he has the last (6th) option, where he can choose number 1-25 and since this is not related to the first 5 options, he can choose any number (1-25) regardless if it was chosen on the prior options. How to enforce this behavior? Also, since we are talking about options, when someone places an order, how to have the options selected displayed on incremental? Greatly appreciated in advance! cheers, AJ Edited March 23 by AeroLogistica typo Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 23 Share Posted March 23 (edited) There is a form validator that could be enhanced to make sure any one selection is not the same as any other selection. There is also the idea of making that option as a set of checkboxes (there would need to be a custom layout) where any five can be checked. But CubeCart is not yet fully coded to show checkboxes. There is also the idea of a single text field where the numbers can be entered, separated by a space, comma, or dash (there would need to be a custom verification), where the label says "Enter five different numbers between 1 and 70". (I think this is the easiest.) Edited March 23 by bsmither Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted March 24 Author Share Posted March 24 Thanks for replying @bsmither, probably the first option is the most professional. Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted March 26 Author Share Posted March 26 Who could help develop that? Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 26 Share Posted March 26 Specifically who, I do not know. However, this is a problem I am interested to solve, and am currently working on it. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 26 Share Posted March 26 Currently, I am not finding a way to make any one specific Option Group (for example, "PowerBall #1") have a relationship to any other specific Option Group(s) (for example, "PowerBall #2", etc). I am still experimenting. Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted March 26 Author Share Posted March 26 1 hour ago, bsmither said: Specifically who, I do not know. However, this is a problem I am interested to solve, and am currently working on it. Thanks a bunch @bsmither Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted March 26 Author Share Posted March 26 40 minutes ago, bsmither said: Currently, I am not finding a way to make any one specific Option Group (for example, "PowerBall #1") have a relationship to any other specific Option Group(s) (for example, "PowerBall #2", etc). I am still experimenting. Maybe JavaScript to handle the interaction between the selected option and the corresponding action or data? Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 26 Share Posted March 26 That would be the solution, but what would be a common attribute among the five selectors, and yet not include the sixth selector? Each selector is a distinct "option" (an option group of attributes) in its own right. There is nothing to relate them as a collection. "handle the interaction between the selected option and the corresponding action or data" The customer selects and option from the selector. But what do you mean by "corresponding action or data"? Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted March 26 Author Share Posted March 26 Hoe about if instead of validating for non repeating values, it checks once the selection is made, in case of repetitive values, the customer will get a warning but we'll have the same issue because of how to exclude option sixth? This one can be repetitive as it's "different" from the other 5, so, how to exclude it? Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted April 1 Author Share Posted April 1 @bsmither my friend mentioned about a set in Javascript: Set objects are collections of values. A value in the set may only occur once; it is unique in the set's collection. You can iterate through the elements of a set in insertion order. I just don't have a clue on how to implement it. Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted April 8 Author Share Posted April 8 Will this do it? on JS $("#id select").each(function() { allOptionsInSelect.push($(this).val()); }); on PHP $elements = $_POST['elements']; $elements = explode(',', $elements); Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 8 Share Posted April 8 The "#id select" might not be what you want. Maybe "#id option:selected". This should find all selected options from the specific DOM node having id="id". (So, this selector may need to be set to 'multiple' to allow to choose five options.) Or maybe "[id^='maingroup'] option:selected". This should find all selected options from the group of selectors having id="maingroup_no1", where no1 is the specific id of the first selector, and no2 is the specific id of the second selector, etc. The format id^='maingroup' means that the id must start with maingroup, and jQuery will find all of them. Then .each() will work on them in turn. Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted April 11 Author Share Posted April 11 Just to add a little challenge to the project, there are two games where the customer can actually select the same numbers, so, I guess on those the approach would have to be different. Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted April 18 Author Share Posted April 18 Howdy! Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted April 25 Author Share Posted April 25 Hi @bsmither, any thoughts? Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 25 Share Posted April 25 I got stuck. Still trying to unravel something. Quote Link to comment Share on other sites More sharing options...
AeroLogistica Posted April 25 Author Share Posted April 25 Thank you @bsmither, I'll stay hopeful Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.