tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Muhammad Gelbana <m.gelb...@gmail.com>
Subject Re: Select Component chaining: 2nd select box value is always null
Date Mon, 05 Mar 2012 11:48:50 GMT
Just a wild guess. If any method is called before validating the form
returns a value that should re-post the form, your field will be null if
it's not persisted.

So for example, is the submit button handling method returning anything or
is it void ?
Try *@Persist*ing your field, if it's not null, then my guess is probably
right.

This link may prove helpful:
http://jumpstart.doublenegative.com.au/jumpstart/examples/navigation/whatiscalledandwhen


On Mon, Mar 5, 2012 at 1:00 PM, Beat Durrer <bdurrer@gmail.com> wrote:

> Hi Giulio,
>
> No, they are not. The form is really straight forward as in the example:
>
>
> <t:form t:id="applicationForm" >
>      <t:errors/>
>
>     <div  class="form-row">
>        <div class="twoColumnFirst">
>           <t:select t:id="category" model="categoryModel"
> encoder="categoryModel" blankOption="ALWAYS"
>              value="categoryItem" zone="subCategoryZone"/>
>        </div>
>        <div class="twoColumnSecond" t:type="zone"
> t:id="subCategoryZone" id="subCategoryZone">
>              <t:select t:id="subCategory" value="subCategoryItem"
>                 model="subCategoryModel" encoder="subCategoryModel"/>
>        </div>
>     </div>
>
>    <div class="form-row">
>       <a t:type="LinkSubmit" t:id="forward" class="button
> button-prim">Next</a>
>    </div>
> </t:form>
>
>
>
>
>
> 2012/3/5 Giulio Micali <giulio.micali@gmail.com>:
> > Are your selects in a loop ?
> >
> >
> >
> > 2012/3/5 Beat Durrer <bdurrer@gmail.com>
> >
> >> Hey there
> >>
> >> For my project I need two chained select boxes.
> >> I followed the example shown in the API
> >> (
> >>
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Select.html
> >> ),
> >> but used my own SelectModel for my custom value type.
> >>
> >> It all looks nice, but when I submit the form, the second select box
> >> is always null.
> >> When I add a @Validate("required") on both fields, the client
> >> validation is happy with the boxes, but the server side validation
> >> fails.
> >> I added some debug output and of course the value turns out to be null
> >> in onValidate()
> >>
> >> Using Firebug I noticed that the second select in the zone changes its
> >> name and id each time the zone updates, it's something like
> >> "carModel_135e275b957"
> >>
> >> Which leads me to the question: What did I do wrong? I never worked
> >> with zones before, so do I need to do some kind of special handling?
> >>
> >>
> >> Cheers and thanks in advance
> >> Beat
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
*Regards,*
*Muhammad Gelbana
Java Developer*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message