onchange dynamic selectbox value return
Renze - October 31, 2006 - 15:55
i have 2 selectbox's in the first selectbox there is a list of country's from db.
When i select a country i want the second selectbox to fill with city's.
So i want a onchange action on the first selectbox. When a selection is made, i want function city() to be called to fill en visualize the second selectbox.
$form['drop'] = array(
'#type' => 'select',
'#title' => t('Country'),
'#options' => $countryArray,
'#attributes' => array('onChange' => 'dropdown_onclick_function()),
);What do have i put in the attributes onchange, and how do i get the value from the first selectbox to return?

re: try this
Try the solution here with an example here
That would work if i was
That would work if i was running drupal 5.x, But i am currently running drupal 4.7 and than the Jquery code gives errors.
There must be a easy way to this.
something like this:
function dropdown_page(){
if($dropdown_value == ""){
$form['drop'] = array(
'#type' => 'select',
'#title' => t('Country'),
'#options' => $countryArray,
'#attributes' => array('onChange' => 'dropdown_page())',
);
}else{
$form['drop2'] = array(
'#type' => 'select',
'#title' => t('City'),
'#options' => $CityArray,
'#attributes' => array('onChange' => 'result())',
);
}
}
My question:
- How do i Call a function with onchange?
- How do i give the value of my drop box with it?
jQuery Module
There is a module for Drupal 4.7.x which is basically a copy of jQuery modified so that it doesn't produce any errors with Drupal's own JS. I think it's called the jQuery module.
Dave
example gone
That solution and example are gone. Anyone have something similar?