Yeah, after you explained further, I knew that was going to be problematic. :)

Try formSupport.defer(Runnable command);

The runnable will get executed after all other actions, just before the form's 
validate event is fired, so the values will be updated at that point. But 
you'll have to defer the action during the form submission, so basically: store 
a component action.  The ComponentAction will invoke formSupport.defer(new 
Runnable() { /* code to update your values goes here */ });  

Incidentally, you mentioned validate in your previous e-mail... each form 
component fires its own validate event, so the validate event you mentioned 
before is not the Form's validate event bubbling down to the components, it's 
the validate event fired by each form field.

Cheers,

Robert

On Aug 23, 2011, at 8/233:23 AM , Jens Breitenstein wrote:

> Hi Robert (and all others),
> 
> sorry to bother you, but
> 
> I implemented a ComponentAction and use FormSupport as you suggested it. And 
> it's near to what I need :-)
> Unfortunately the "execute" method is called before tapestry updates the 
> property thus I see the orginal value not the new one?
> Any idea how to solve the last piece of the puzzle?
> 
> Jens
> 
> 
> 
> ...
>    @Property(write = false)        // ---->> test to see when tapestry 
> reflects changes
>    private boolean _weeklyNewsletter;
> 
>    @Component(id = "weeklyNewsletter", parameters = 
> {"value=weeklyNewsletter"})
>    private Checkbox _weeklyNewsletterCheckbox;
> 
> 
>    @Environmental
>    private FormSupport _formSupport;
> 
>    private static class NewsletterComponentAction implements 
> ComponentAction<Newsletter>
>    {
>        // ---->> called but properties not set yet
>        public void execute(final Newsletter c)
>        {
>            c._userAccount.setNewsLetter("" + (c._dailyNewsletter ? "1" : "0")
>                                              + (c._weeklyNewsletter ? "1" : 
> "0") + (c._monthlyNewsletter ? "1" : "0"));
>        }
>    }
> 
>    public void setupRender()
>    {
> ...
>        _formSupport.store(this, new NewsletterComponentAction());
>    }
> 
>    // ---->> this method is called after execute?
>    public void setWeeklyNewsletter(final boolean b)
>    {
>        _weeklyNewsletter = b;
>    }
> ....
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 


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

Reply via email to