Home › Forums › Quform WordPress › Get value for prepopulated Dropdown Menu
- This topic has 3 replies, 2 voices, and was last updated 9 years ago by ulir.
- AuthorPosts
- March 25, 2015 at 11:54 am #14790ulirParticipant
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');</codeHow 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.
March 25, 2015 at 11:56 am #14791ulirParticipantI’m sorry for the mess above, but for some reason I’m not allowed to edit my own post?
March 30, 2015 at 10:00 am #14813AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 30, 2015 at 10:36 am #14814ulirParticipantHi,
that worked very well, thank you!
- AuthorPosts
- You must be logged in to reply to this topic.