Skip Navigation

[Resolved] Need to add id to select form field

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by LandruF8417 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#918120

How can I add an id to the search field in this example?

[wpv-control taxonomy="attorney-practice-area" id="wpv_control_select_practice_area" url_param="wpv-attorney-practice-area" type="select" default_label="BY PRACTICE" taxonomy_order="ASC" taxonomy_orderby="name" hide_empty="false"]

#918161

Hello,

There isn't such an exact feature within Views shortcode [wpv-control], no "id" attribute.

If you are going to apply custom CSS codes or JS codes to it, you can try with attribute selector, for example:

select[name="wpv-attorney-practice-area"]{
// here add your CSS codes
}

More help:
hidden link

#918162

thanks Lou but I need the id to so that I can specify a label to the field in order to make the form ADA Compliant.

#918164

As I mentioned above, no "id" attribute in the shortcode [wpv-control], see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control
If you agree, we can take it as a feature request.

You might consider to use custom JS codes to add the ID attribute, for example:

jQuery(document).ready(function ($){
    $('select[name="wpv-attorney-practice-area"]').attr('id', 'wpv_control_select_practice_area');
})
#918168

Ok Thanks. Lou. I may try that in the future. For now, I found a workaround by wrapping the label tag around the field.

Thanks

#918172

Sorry Lou, one more question.

Is it possible to add the id to this:

[wpv-filter-search-box class="text-search"]

Thanks

#918173

The shortcode [wpv-filter-search-box] does not support id attribute too, see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-filter-search-box

You might try the same workaround as you mentioned above:
wrapping the label tag around the field.

#918174

Thank Luo. The wrap around idea did not work for text field but your JS solution did work to add the id to the field.

Thanks Again!