You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Fred Feuerstein <FF...@gmx.net> on 2004/11/18 11:58:14 UTC
ValidFiled only required when ...
Hi,
I would like to validate some of my form elements after the user hit the
"submit"-button.
Therefor I defined my needed components and linked the usefull validator to
it. (see below)
myPage.page:
[..]
<bean name="required" class="org.apache.tapestry.valid.StringValidator"
lifecycle="page">
<set-property name="required" expression="true"/>
</bean>
<component id="value1" type="ValidField">
[..]
<binding name="validator" expression="beans.required"/>
[..]
</component>
<component id="value2" type="ValidField">
[..]
<binding name="validator" expression="beans.required"/>
[..]
</component>
[..]
Using this definition, both elements are required. BUT, it is only needed
that one of them is not empty.
1. 'Value1=empty' AND 'Value2=not empty' => OKAY
2. 'Value1=not empty' AND 'Value2=empty' => OKAY
3. 'Value1=not empty' AND 'Value2=not empty' => OKAY
4. 'Value1=empty' AND 'Value2=empty' => NOT OKAY
How can I do this? Group components together??
Any examples available?
Many thanks in advance!
Fred
--
Geschenkt: 3 Monate GMX ProMail + 3 Top-Spielfilme auf DVD
++ Jetzt kostenlos testen http://www.gmx.net/de/go/mail ++
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: PageLink with Button
Posted by Andreas Vombach <an...@psi.ch>.
...ok, the HTML can remain empty and the component is called with
<button jwcid="@PageButton" targetPage="newpage" label="go" />
Thanks again
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: PageLink with Button
Posted by Andreas Vombach <an...@psi.ch>.
Thank you, Markus for the component code. I'm (still) not too firm with
Components, I guess I'll need a PageButton.jwc like
<component-specification
class="org.tdr.ui.components.PageButton"
allow-body="no"
allow-informal-parameters="no">
<parameter name="targetPage" type="java.lang.String" required="yes"
direction="in"/>
<parameter name="label" type="java.lang.String" required="no"
direction="in"/>
<parameter name="disabled" type="java.lang.String" required="no"
direction="in"/>
</component-specification>
and some HTML spec file I'm not sure about the content ...??
Cheers Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: PageLink with Button
Posted by Markus Wiederkehr <ma...@gmail.com>.
I have written my own component for this purpose. Have a look at the
attached source code.
Markus
On Thu, 18 Nov 2004 12:27:42 +0100, Andreas Vombach
<an...@psi.ch> wrote:
> Normally a PageLink component looks like
>
> <a href="#" jwcid="@PageLink" page="mypage">goto my page</a>
>
> This is fine but is it also possible to embed a HTML button instead of
> the link? I would like to have a page with some text to be read and a
> button which links to another page without having to define a java class
> or using an image.
PageLink with Button
Posted by Andreas Vombach <an...@psi.ch>.
Normally a PageLink component looks like
<a href="#" jwcid="@PageLink" page="mypage">goto my page</a>
This is fine but is it also possible to embed a HTML button instead of
the link? I would like to have a page with some text to be read and a
button which links to another page without having to define a java class
or using an image.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: ValidFiled only required when ...
Posted by Markus Wiederkehr <ma...@gmail.com>.
Consistency checks have to done manually in the listener method.
See http://nagoya.apache.org/eyebrowse/ReadMsg?listName=tapestry-user@jakarta.apache.org&msgNo=10209
Markus
On Thu, 18 Nov 2004 11:58:14 +0100 (MET), Fred Feuerstein
<ff...@gmx.net> wrote:
> Hi,
>
> I would like to validate some of my form elements after the user hit the
> "submit"-button.
> Therefor I defined my needed components and linked the usefull validator to
> it. (see below)
>
> myPage.page:
> [..]
> <bean name="required" class="org.apache.tapestry.valid.StringValidator"
> lifecycle="page">
> <set-property name="required" expression="true"/>
> </bean>
>
> <component id="value1" type="ValidField">
> [..]
> <binding name="validator" expression="beans.required"/>
> [..]
> </component>
>
> <component id="value2" type="ValidField">
> [..]
> <binding name="validator" expression="beans.required"/>
> [..]
> </component>
> [..]
>
> Using this definition, both elements are required. BUT, it is only needed
> that one of them is not empty.
> 1. 'Value1=empty' AND 'Value2=not empty' => OKAY
> 2. 'Value1=not empty' AND 'Value2=empty' => OKAY
> 3. 'Value1=not empty' AND 'Value2=not empty' => OKAY
> 4. 'Value1=empty' AND 'Value2=empty' => NOT OKAY
>
> How can I do this? Group components together??
> Any examples available?
>
> Many thanks in advance!
>
> Fred
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org