You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Thijs Suijten <t....@semantica.nl> on 2004/05/13 12:47:54 UTC

ValidationDelegate add component

I'm writing a ValidationDelegate.

In the writeSuffix method I want to display an error icon.

I've already written a Icon component which renders an icon.

I would like to use the Icon component in the writeSuffix method. This means
that I have to instantiate a component in java@runtime. Are there any
methods to add a component in Java?

Thijs

----------------------------------------------------------------------------
----

SEMANTICA

Thijs Suijten
Email: t.suijten@semantica.com
Web: http://www.semantica.nl
Phone: 0031 71 5414471
Fax: 0031 71 5411892


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.681 / Virus Database: 443 - Release Date: 10-5-2004

Re: How to turn off validation delegate on submit?

Posted by Michael Hamilton <mi...@actrix.gen.nz>.
I situations such as the one you describe I just clear the 
errors as part of the button handling code:

   if ("refreshButton".equals(button)) {
     this.getBeans().getBean("statusDelegate").clear()
     ...
   }

(actually my own subclass of  Basepage has a helper method
to get the delegate - so it doesn't look as untidy as this.)


On Wed, 19 May 2004 21:17, Michal Prinke wrote:
> Hello,
>
> I have some form with a few @ValidFields. There are two submit buttons
> on this form - the first one refreshes the form (+ fills some additional
> information), while the latter writes the data to database and redirects
> user to some other location.
>
> The "Write to DB" submit button uses an additional listener.
>
> My problem is that I don't want validation delegate to mark fields
> as bad when user clicks the "Refresh" submit button, even if they
> contain incorrect values. I want it to work only if user clicks "Write
> to DB".
>
> How to achieve this?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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


RE: How to turn off validation delegate on submit?

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
The interactions on the client side are getting pretty devious!

If you obtain the form object on the client (i.e., var form = document.Form0) and invoke
form.submit() then the onsubmit event handlers are *not* invoked.

This lets you bypass validation, but also breaks a few select components, such as Palette.

For 3.1 I expect to have a simple library in place for managing Form event handlers on the client
side better. I prototyped a version of it on-the-fly while at my gig in Germany.

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: Michal Prinke [mailto:bogien@icpnet.pl] 
> Sent: Wednesday, May 19, 2004 5:17 AM
> To: Tapestry users
> Subject: How to turn off validation delegate on submit?
> 
> 
> Hello,
> 
> I have some form with a few @ValidFields. There are two 
> submit buttons on this
> form - the first one refreshes the form (+ fills some 
> additional information),
> while the latter writes the data to database and redirects 
> user to some other
> location.
> 
> The "Write to DB" submit button uses an additional listener.
> 
> My problem is that I don't want validation delegate to mark fields
> as bad when user clicks the "Refresh" submit button, even if 
> they contain
> incorrect values. I want it to work only if user clicks "Write to DB".
> 
> How to achieve this?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 



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


How to turn off validation delegate on submit?

Posted by Michal Prinke <bo...@icpnet.pl>.
Hello,

I have some form with a few @ValidFields. There are two submit buttons on this
form - the first one refreshes the form (+ fills some additional information),
while the latter writes the data to database and redirects user to some other
location.

The "Write to DB" submit button uses an additional listener.

My problem is that I don't want validation delegate to mark fields
as bad when user clicks the "Refresh" submit button, even if they contain
incorrect values. I want it to work only if user clicks "Write to DB".

How to achieve this?


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


RE: ValidationDelegate add component

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Remember, IRender is the superclass of IComponent.  You don't instantiate a component, you *locate*
the component.
Put the component on a page, inside a Block (where it normally won't render), use the IRequestCycle
to lookup the object, and just return it.

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Tapestry: Java Web Components 
Creator, HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: Thijs Suijten [mailto:t.suijten@semantica.nl] 
> Sent: Thursday, May 13, 2004 6:48 AM
> To: tapestry-user@jakarta.apache.org
> Subject: ValidationDelegate add component
> 
> 
> I'm writing a ValidationDelegate.
> 
> In the writeSuffix method I want to display an error icon.
> 
> I've already written a Icon component which renders an icon.
> 
> I would like to use the Icon component in the writeSuffix 
> method. This means
> that I have to instantiate a component in java@runtime. Are there any
> methods to add a component in Java?
> 
> Thijs
> 
> --------------------------------------------------------------
> --------------
> ----
> 
> SEMANTICA
> 
> Thijs Suijten
> Email: t.suijten@semantica.com
> Web: http://www.semantica.nl
> Phone: 0031 71 5414471
> Fax: 0031 71 5411892
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.681 / Virus Database: 443 - Release Date: 10-5-2004
> 



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