Hi!

I have been reading tha 'ajax integration' chapter from symfony book, 
but i haven't figured out how to make it work.

The thing is:
I want that when i select something in a combo box (1st. combo) the 
options in the 2th. combo change.

Until now i have this.

First i have de form:
$this->form = new DenunciaForm()

--- inside this form i have an embedded form
$denunciante = new PersonaForm()

--- inside this embedded form i have two combo box
>     $this->widgetSchema['estado_id'] = new sfWidgetFormPropelChoice(
>       array(
>         'model'      => 'Estado',
>         'add_empty'  => false,
>         'order_by'   => array('Nombre', 'asc'),
>         'default'    => $estado_id->getId(),
>       ),
>       array(
>         'onchange'   => 'getMisMunicipios(this.value)',
>       )
>     );
>     $this->widgetSchema['municipio_id'] = new sfWidgetFormPropelChoice(
>       array(
>         'model'       => 'Municipio',
>         'add_empty'   => false,
>         'order_by'    => array('Nombre', 'asc'),
>         'criteria'    => $criteria_mun,
>       )
>     );

Here, everything good, the combos take the 'onchange'  function 
perfectly, (but not the default)

here my HTML:

<select onchange="getMisMunicipios(this.value)"
name="denuncia[denunciantes][estado_id]"
id="denuncia_denunciantes_estado_id">
<option value="2">Apure</option>
<option value="1">Aragua</option>
<option value="3">Carabobo</option>
</select>
<select onchange="getMisParroquias(this.value)"
name="denuncia[denunciantes][municipio_id]"
id="denuncia_denunciantes_municipio_id">
<option value="2">Libertador</option>
<option value="3">Naguanagua</option>
<option value="1">Valencia</option>
</select>

Now, i test the javascript:

> <?php use_helper('Javascript') ?>
> <?php echo javascript_tag("
>   function getMisMunicipios(id)
>   { alert(id) }
>
> ") ?>

and this work perfectly, The problem is that i dont understand how to 
fill the second combo box with new values when i select something 
different in the 1st one.

THANKS!!!!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to