You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andy Pahne <ap...@net22.de> on 2008/08/27 11:24:17 UTC

[T5] my form does not update page properties

I must be missing something, because my form does not update my page 
property.


public class SearchItems{

     ...

     @Property @Persist
     private SearchOptions searchOptions;

	@Inject
	private Block searchOutput;

     public void onPrepareForRender() {
         System.out.println("prepareForRender()");
         if(searchOptions == null) {
             searchOptions = SearchOptions.getInstance();
         }
     }

     public Object onSuccess() {
	    System.out.println(searchOptions.getSearchTermCountry());
	    return searchOutput;
     }



            <!-- form -->
         <form t:type="Form"
               t:zone="resultZone"
               t:autofocus="true">

             <tr>
                 <td class="formFieldLabel" valign="top" align="right">
                     <t:label for="searchTermCountry"/>
                 </td>
                 <td class="formField">
                     <input t:type="TextField"
                            t:value="searchOptions.searchTermCountry"
                            t:id="searchTermCountry"/>
                 </td>
             </tr>

              <tr>
                  <td class="formButtons" colspan="2">
                           <input t:type="submit"
                                  t:clientId="Submit"
                                  value="Suchen"/>
                  </td>
              </tr>

         </form>

         <!-- results -->
         <t:zone id="resultZone">

               Please adjust search criteria

               <t:block id="searchOutput">
                   <h3 class="summaryHeader">Result</h3>
                   Land: ${searchOptions.searchTermCountry}
               </t:block>

         </t:zone>

}




The property searchOptions.searchTermCountry is not updated when the 
form is submitted.

What am I missing here?


Andy





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] my form does not update page properties

Posted by Dave Dombrosky <do...@gmail.com>.
I have also noticed this.  It only seems to happen when the form
accesses variables stored inside the @Persisted class.

I'm not sure if this is a bug or just a limitation of @Persist.  Only
workaround I have for now is to move all the variables into the
tapestry component, and then add @Persist to all of them.

-Dave


On Wed, Aug 27, 2008 at 5:24 AM, Andy Pahne <ap...@net22.de> wrote:
>
> I must be missing something, because my form does not update my page
> property.
>
>
> public class SearchItems{
>
>    ...
>
>    @Property @Persist
>    private SearchOptions searchOptions;
>
>        @Inject
>        private Block searchOutput;
>
>    public void onPrepareForRender() {
>        System.out.println("prepareForRender()");
>        if(searchOptions == null) {
>            searchOptions = SearchOptions.getInstance();
>        }
>    }
>
>    public Object onSuccess() {
>            System.out.println(searchOptions.getSearchTermCountry());
>            return searchOutput;
>    }
>
>
>
>           <!-- form -->
>        <form t:type="Form"
>              t:zone="resultZone"
>              t:autofocus="true">
>
>            <tr>
>                <td class="formFieldLabel" valign="top" align="right">
>                    <t:label for="searchTermCountry"/>
>                </td>
>                <td class="formField">
>                    <input t:type="TextField"
>                           t:value="searchOptions.searchTermCountry"
>                           t:id="searchTermCountry"/>
>                </td>
>            </tr>
>
>             <tr>
>                 <td class="formButtons" colspan="2">
>                          <input t:type="submit"
>                                 t:clientId="Submit"
>                                 value="Suchen"/>
>                 </td>
>             </tr>
>
>        </form>
>
>        <!-- results -->
>        <t:zone id="resultZone">
>
>              Please adjust search criteria
>
>              <t:block id="searchOutput">
>                  <h3 class="summaryHeader">Result</h3>
>                  Land: ${searchOptions.searchTermCountry}
>              </t:block>
>
>        </t:zone>
>
> }
>
>
>
>
> The property searchOptions.searchTermCountry is not updated when the form is
> submitted.
>
> What am I missing here?
>
>
> Andy
>
>
>
>
>
> ---------------------------------------------------------------------
> 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