I am trying to modify the fields created in a webform to reach something like this:
$form['province']= array (
'idProvincia' => array (
'#type' => 'select',
'#title'=> t('Province'),
'#description' => '',
'#weight' => '6',
'#options' => custom_forms_obtenerProvincias(),
'#suffix' => '
',
'#ahah' => array(
'path' => 'custom_forms/carga_localidades/callback',
'wrapper' => 'poblacionesActBlock',
'effect' => 'fade'
),
),
);
$form['poblaciones'] = array(
'#tree' => TRUE,
'#prefix' => '
'#suffix' => '
'
);
$form['poblaciones']['idLocalidad'] = array(
'#type' => 'select',
'#title' => t('Town'),
'#options' => custom_forms_obtenerLocalidades(),
);
i am trying it through the hook custom_forms_form_alter(&$form, &$form_state, $form_id)
that I´m using in my module custom_forms but i don´t find the correct way to make this.
I´m not able to add what i want to the fields created
Can anybody helpme? thanks in advance!!!
Comments
Comment #1
Enxebre CreditAttribution: Enxebre commentedExplained in a better way, what i need to have are two select fields ( created in the webform ) relationed by an onchange event
Comment #2
quicksketchSee #732114: Merge Webform Conditional into Webform (support for same-page conditional fields).
Comment #3
Enxebre CreditAttribution: Enxebre commentedThank you for your reply.
I read this link and I´m using the conditional_webform module for load somefields in my webform but it isn´t exactly what I want in this case.
I want to load always the same field bringing differents values depending on the value selected in the other field.
Modifing in the selec.inc of webform module like this:
I have some positives results but when i´m not able to catch the data sent by this field.
$_POST['province'] Seems not to be the correct name. How can I see all the $_POST variables in that moment?
I tried adding something like this in the function custom_forms_cambiarPoblaciones_callback() :
but I get a callback error.
Thank you!!