Get value for prepopulated Dropdown Menu

Home Forums Quform WordPress Get value for prepopulated Dropdown Menu

This topic is: resolved
  • This topic has 3 replies, 2 voices, and was last updated 9 years ago by ulir.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14790
    ulir
    Participant

    Hi there,

    I used custom code to populate a dropdown
    function lager_kategorien_werte($form)
    {
    global $wpdb;
    $mydb = new wpdb(DB_USER, DB_PASSWORD, 'mydb', DB_HOST);

    $query = $mydb->get_results("SELECT DISTINCT kategorie FROM moebel_abfrage ORDER BY kategorie ASC", ARRAY_A);
    $options = array();
    foreach($query as $row){
    $options[] = array('label' => $row['kategorie'], 'value' => $row['kategorie']);
    }
    $options[] = array('label' => "Andere Kategorie", 'value' => "neuKat");

    $dropdown = $form->getElement('iphorm_2_2');
    if ($dropdown instanceof iPhorm_Element_Select) {
    $dropdown->setOptions($options);
    }
    }
    add_action('iphorm_pre_display_2', 'lager_kategorien_werte');</code

    How can I create a conditional field in my form that is only shown when the value "neuKat" (or any other value in the dropdown) is selected? I cannot see the labels and values in the form administration page.

    #14791
    ulir
    Participant

    I’m sorry for the mess above, but for some reason I’m not allowed to edit my own post?

    #14813
    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.

    #14814
    ulir
    Participant

    Hi,

    that worked very well, thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy