I am working on a form where I need to load a second dropdown based on the selection of the first selection. The first selection is populated from an XML response... how do I use the Key Value to load my second dropdown?
<select name='Pub_ID' id='s1' onchange=AjaxFunction();>
<?php
$feed_url = 'http://mywebsite.com/xml=?affiliate_id=0&affiliate_name=&accmanager_id=0&tag_id=0&start_at_row=1&row_limit=10000&sort_field=affiliate_id&sort_descending=FALSE';
$xml = simplexml_load_file($feed_url);
foreach($xml->affiliates->affiliate as $affs){
echo "<option value='".$affs->affiliate_id."'>" . $affs->affiliate_name . "</option>";
}
?>
</select>
Hi esl,
it looks as though this code is creating a standard HTML dropdown so you can use a jQuery Ajax call to load the second dropdown.
If you change this PHP to create an array of ids and names then you could use the Dynamic Data settings in a ChronoForms dropdown and the Events tab settings to call the Ajax event. The array needs to look like this:
Bob
it looks as though this code is creating a standard HTML dropdown so you can use a jQuery Ajax call to load the second dropdown.
If you change this PHP to create an array of ids and names then you could use the Dynamic Data settings in a ChronoForms dropdown and the Events tab settings to call the Ajax event. The array needs to look like this:
<?php
$form->data['affiliates'] = array(
[0] => array(
'value' => 'affiliate_id',
'text' => 'affiliate_name'
),
[1] => array(
. . .
),
);
?>
Bob
This topic is locked and no more replies can be posted.