Tapestry 5 zone inside a form

3.3k views Asked by At

I have a form and inside it I have a country/city/etc selection.
The form is inside a zone.
When calling the onSelected for make the change of the country/city, when returning I loose the other form data. How can I keep it ?
I think a zone inside the form would help, but I am getting:
Form components may not be placed inside other Form components.
The Ubigeos type is just a component with other selects that are filled from the pais select

My .tml is

<t:zone t:id="datosPersonalesZone">
    <form t:type="form" t:id="formulariodatospersonales" t:zone="datosPersonalesZone">
    <t:errors/>
         Sexo:  <select t:type="Select" t:id="sexo" t:value="actual.sexo" model="sexo" /> 
         PaĆ­s:  <input t:type="Select" t:id="pais" model="paises" t:value="pais"  t:zone="ubigeosZone"/>

         <t:zone t:id="ubigeosZone">
            <input t:type="Ubigeos" t:id="ubigeo_nacimiento" t:ubigeo="ubigeoNacimiento" t:zone="ubigeosZone"/>
        </t:zone>
   </form>

Regards !

1

There are 1 answers

0
antonlitvinenko On

You either have to submit a form and process country selection differently (i.e. only updating form contents by returning a block) or try using ideas from FormFragment component and TriggerFragment mixin (probably you can't use them directly but you can try extending them to support select components).

Personally, I go with first option - I have a "SubmitFormOnEvent" mixin and attach it to select-s in the form. Then I found that similar approach is demonstrated at http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxselect1 -> so you just can start with that example and update it to your needs.