Hi Jens, Robert, and others,

I've tried to capture the techniques described in this thread in 3 new 
JumpStart examples. Could you please run your eye over them and let me know if 
I've missed anything?

They're called "Sub-Form Component", "Sub-Form Validation", and "Sub-Form As a 
Field" in http://jumpstart.doublenegative.com.au/jumpstart/

Cheers,

Geoff

On 23/08/2011, at 7:34 PM, Jens Breitenstein wrote:

> ok Robert! you are a genious, that did the trick.
> 
> for all T5'ers interested in Robert's solution see below both possible 
> versions.
> 
> BUT:
> 
> 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.
> 
> 
> precisely, this was just an example and an inaccurate one I have to admit.
> 
> Can't we just get OPTIONAL event methods on the components to participate in 
> form handling like
> 
> onSuccess
>    (called before page.onSuccess is executed, which gives components a change 
> to update the model partly and the page persists everything for example)
> 
> onFailure
>    (called before page.onFailure, it's more obvious as ommiting calls to 
> onSuccess in case of errors)
> 
> Personally I think this will increase usage of compontents as logical units 
> by avoiding serialization and customBindings at all? And optional means we do 
> not break any existing T5 code. Is this something for you T5-committers to 
> think about or is this absolute nonsense?
> 
> 
> thanks
> 
> 
> Jens
> 
> 
> 
> 
> 
> 
> VERSION 1:
> -------------
> 
>    private static class NewsletterComponentAction implements 
> ComponentAction<Newsletter>
>    {
>        public void execute(final Newsletter c)
>        {
>            c._userAccount.setNewsLetter("" + (c._dailyNewsletter ? "1" : "0") 
> + (c._weeklyNewsletter ? "1" : "0") + (c._monthlyNewsletter ? "1" : "0"));
>        }
>    }
> 
>    public void setupRender()
>    {
>        String newsletter = _userAccount.getNewsLetter();
> 
>        _dailyNewsletter = newsletter.substring(0, 1).equals("1");
>        _weeklyNewsletter = newsletter.substring(1, 2).equals("1");
>        _monthlyNewsletter = newsletter.substring(2, 3).equals("1");
>    }
> 
>    public void afterRender()
>    {
>        _formSupport.store(this, new NewsletterComponentAction());
>    }
> 
> 
> 
> VERSION 2:
> -------------
> 
>    private static class NewsletterComponentAction implements 
> ComponentAction<Newsletter>
>    {
>        public void execute(final Newsletter c)
>        {
>            c._formSupport.defer(new Runnable()
>            {
>                public void run()
>                {
>                    c._userAccount.setNewsLetter("" + (c._dailyNewsletter ? 
> "1" : "0") + (c._weeklyNewsletter ? "1" : "0") + (c._monthlyNewsletter ? "1" 
> : "0"));
>                }
>            });
>        }
>    }
> 
>    public void setupRender()
>    {
> ...
>        _formSupport.store(this, new NewsletterComponentAction());
>    }
> 
> 
> ---------------------------------------------------------------------
> 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