Hi,
I'm new to Joomla and I would like to have a dropdown in my chronoform. I want to pre populate this drop down when the form gets loaded. I tried using form->data array. I think I'm doing it wrong. Here is what I did.
- I placed the drop down in the form through form wizard with field_id as 'time_period'.
- following are the values under Dynamic Data tab.
> Enabled - Yes
> Data Path - period
> Value Key - value
> Text Key - text
- I added load JS event on load of the form and I have the following code in Load JS event.
window.addEvent('domready', function(){
/*Some Java Script code here */
<?php
echo "alert(\"hello\")";
$form->data['period']=array();
$form->data['period'][0]=array('value' => '1', 'text' => 'Yes');
$form->data['period'][1]=array('value' => '2', 'text' => 'No');
?>
});
But the drop down is not getting populated. I don't know what I'm missing. Really appreciate any help on this.
Thanks,
Archana.
I'm new to Joomla and I would like to have a dropdown in my chronoform. I want to pre populate this drop down when the form gets loaded. I tried using form->data array. I think I'm doing it wrong. Here is what I did.
- I placed the drop down in the form through form wizard with field_id as 'time_period'.
- following are the values under Dynamic Data tab.
> Enabled - Yes
> Data Path - period
> Value Key - value
> Text Key - text
- I added load JS event on load of the form and I have the following code in Load JS event.
window.addEvent('domready', function(){
/*Some Java Script code here */
<?php
echo "alert(\"hello\")";
$form->data['period']=array();
$form->data['period'][0]=array('value' => '1', 'text' => 'Yes');
$form->data['period'][1]=array('value' => '2', 'text' => 'No');
?>
});
But the drop down is not getting populated. I don't know what I'm missing. Really appreciate any help on this.
Thanks,
Archana.