is to possible to have the select entries grouped (optgroup) by model and engine. For example for model:
GOLF
Golf 1 (2000-2003)
Golf 2 (2003 – 2008)
PASSAT
Passat 1 (2000-2003)
Passat 2 (2003 – 2008)
And for engine:
Diesel
1.6 (34kw)
1.8 (90kw)
Gasoline
2.3 (100kw)
4.0 (200lw)
Looking forward to your reply.
BR,
hamirom
I want to use the <optgroup> in <select> dropdown field.
How can I do that?
I need to make optgroup in select in form, and i found the decision, it seems everything is correct but it doesn’t work:
source: https://www.gilluminate.com/2011/08/08/using-jquery-to-enable-optgroup-in-cforms/
In header.php:
<script type="text/javascript">
if($(".cform").length!=0){
$(".cform select option").each(function(){
if($(this).val() == "groupstart"){
var label = $(this).text();
$(this).nextUntil('option[value|="groupend"]')
.wrapAll("<optgroup label='"+label+"' />");
$(this).detach();
}
});
$('option[value|="groupend"]').detach();
}
</script>
Once you have that code in place, all you need to do is add groupstart and groupend codes to your cforms settings for your select box. For the groupstart you will add it as though it were just another option, with the label being the label you want for your group, and the value being the literal string “groupstart.” For the groupend, it doesn’t matter what the label is, as long as the value is “groupend.” It’s easiest just to use groupend as the label, and leaving the value empty so that CForms will automatically use the label as the value.
and in form:
Color#Choose#Warm Colors|groupstart#red#orange#yellow#|groupend#Cool Colors|groupstart#blue#green#purple#|groupend#brown#black#white
It should be like this:
https://www.gilluminate.com/wp-content/uploads/optgroup-cforms.png
But i get this:
https://oi67.tinypic.com/wjeyk0.jpg
https://oi64.tinypic.com/5mhleg.jpg
WHY IT DOESNT WORK?
]]>I have two specific needs on the register and account pages:
– I need to be able to populate a dropdown field in php with custom optgroup
and options
. I have found the wpum_get_registration_fields
filter but it seems that I can only add options
and not optgroups
with this solution.
– I need to display a fieldset
with several checkboxes, is there a way to create a new type of field associated with a custom template?
Thanks for your help!
]]>Thanks for your plugin, it works great so I’ve bought the bundle legacy extensions too :). However I need to display an <optgroup>
in a dropdown input type on the register form. I’ve added the field withtlm_add_form_field
but I haven’t found a way to add an optgroup
and not just options.
Edit: I’m also open to any other solution that will allow me to show hierarchy in the select list WITHOUT loosing the search by letter ability.
Could you help me?
Thanks.
]]>https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup
Thanks!
]]>I’d like to group the items in the list I’m creating, like:
-Cars-
Mazda
GM
Toyota
-Trucks-
Dodge
Ford
Thanks.
]]>Thank you!
]]>