Select options id are not unique

Home Forums Quform WordPress Select options id are not unique

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  Antongu 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #24948

    Antongu
    Participant

    Hi,
    I found the code below in the forum that I using to import the taxonomies into the live select element:

    
    function my_pre_display($form) {
    $options = array();
    $terms = get_terms(array('taxonomy' => 'ad_locations', 'orderby' => 'none', 'fields' => 'all'));
    foreach ($terms as $term) {
    	$options[] = array(
    	'label' => ($term->parent ? ' — ' : '').$term->name,
    	'value' => $term->slug
    	);
    }
    $checkboxes = $form->getElement('quform_3_71');
    $checkboxes->setOptions($options);
    }
    add_action('quform_pre_display_3', 'my_pre_display');
    

    everything works fine, but the id’s of all the option elements are same, what cause the issue – when you click on any label, it checks the first checkbox (because all the id’s are same).

    Do you know how to solve it?

    Thanks
    Anton

    • This topic was modified 3 months ago by  Antongu.
    Attachments:
    You must be logged in to view attached files.
    #24982

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #24993

    Antongu
    Participant

    Thanks, that solved it!

    maybe you know why the first item is not appearing under it’s parent? (the second item is it’s parent)
    It should be something about ordering but everything I tried didn’t work.

    #25025

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #25057

    Antongu
    Participant

    Thank you very much, I will try it.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.