You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ramin <i8...@gmail.com> on 2005/02/25 22:42:01 UTC

Form validation - customization

Going through the Tapestry tutorial on the appfuse wiki site I noticed
that Tapestry uses its own javascript functions to do form validation.
Is it possible to change this to use my own validation package
(fValidate)?

I also noticed how the server side error messages are displayed. Is it
possible to modify that as well? Like, could I just get a collection
of errors and display them any way that I like on the page?

If these things are possible, is it a difficult thing to do. Like do I
have to go in and modify actual tapestry code or is there a simple way
I can introduce my own js validation library and define my own error
message rendering?

Thanks
-- 
- Ramin

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


Re: Form validation - customization

Posted by "matthew c. mead" <m-...@goof.com>.
The regular html attributes passing through is determined by whether or 
not the component you're talking about supports informal parameters.  
Many (most?) do.

You can use other elements than span.  If there's a 1-to-1 
correspondence between what component I'm inserting and the html 
elements, I often do this, e.g.:

<form jwcid="@Form" listener="ognl:listeners.formSubmit">



-matt

Ramin wrote:

>Oh boy... I'm new to Tapestry coming from a purely jsp/jstl/servlets
>world and this syntax is really scaring me. jwcid? ognl? man.. im
>gonna have to get used to this..
>
>within those span tags, would I be able to put regular html
>attributes, like id="errors" or class="error"? and does it have to be
>spans? could I use <ul> or any other tags?
>
>
>On Fri, 25 Feb 2005 14:13:13 -0800, Paul Ferraro <pm...@columbia.edu> wrote:
>  
>
>>Ramin wrote:
>>
>>    
>>
>>>Going through the Tapestry tutorial on the appfuse wiki site I noticed
>>>that Tapestry uses its own javascript functions to do form validation.
>>>Is it possible to change this to use my own validation package
>>>(fValidate)?
>>>
>>>
>>>
>>>      
>>>
>>Every validator that contributes client-side javascript validation will
>>let you override the IScript that it uses.
>>e.g.
>><bean name="stringValidator"
>>class="org.apache.tapestry.valid.StringValidator">
>>    <set-property name="scriptPath" expression="..."/>
>></bean>
>>
>>See the javadoc for the particular IValidator for details on
>>customizable attributes.
>>
>>    
>>
>>>I also noticed how the server side error messages are displayed. Is it
>>>possible to modify that as well? Like, could I just get a collection
>>>of errors and display them any way that I like on the page?
>>>
>>>
>>>
>>>      
>>>
>>Yes.  e.g.
>>
>><span jwcid="@Foreach" source="ognl:beans.delegate.fieldTracking"
>>value="ognl:fieldTracking">
>>    <span jwcid="@Conditional" condition="ognl:fieldTracking.inError">
>>       <span jwcid="@Delegator"
>>delegate="ognl:fieldTracking.errorRenderer"></span><br/>
>>    </span>
>></span>
>>
>>    
>>
>>>If these things are possible, is it a difficult thing to do. Like do I
>>>have to go in and modify actual tapestry code or is there a simple way
>>>I can introduce my own js validation library and define my own error
>>>message rendering?
>>>
>>>
>>>
>>>      
>>>
>>If you want to override the validation error text itself, that can also
>>be customized in the same way as described above for the script path.
>>
>>Paul
>>
>>    
>>
>>>Thanks
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>
>  
>

-- 
matthew c. mead

http://www.goof.com/

Re: Form validation - customization

Posted by Paul Ferraro <pm...@columbia.edu>.
Ramin wrote:

>Oh boy... I'm new to Tapestry coming from a purely jsp/jstl/servlets
>world and this syntax is really scaring me. jwcid? ognl? man.. im
>gonna have to get used to this..
>
>  
>
Don't be scared...  My examples used inline components.  Standard 
components are far cleaner to use/read.  Read more about the distinction 
in Chapter 2 of the User Guide:
http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/template.components.html

>within those span tags, would I be able to put regular html
>attributes, like id="errors" or class="error"? and does it have to be
>spans? could I use <ul> or any other tags?
>
>  
>
Of course.  Tapestry is incredibly flexible!  e.g.

<ul jwcid="@Foreach" source="ognl:beans.delegate.fieldTracking" value="ognl:fieldTracking" element="ul">
  <li jwcid="@Conditional" condition="ognl:fieldTracking.inError" element="li">
    <div id="error"><span jwcid="@Delegator" delegate="ognl:fieldTracking.errorRenderer"></span></div>
  </li>
</ul>

I sounds like you need to read up on how Tapestry works in general.  At 
the moment, the best Tapestry how-to guide is Howard's book, "Tapestry 
in Action".

Paul

>On Fri, 25 Feb 2005 14:13:13 -0800, Paul Ferraro <pm...@columbia.edu> wrote:
>  
>
>>Ramin wrote:
>>
>>    
>>
>>>Going through the Tapestry tutorial on the appfuse wiki site I noticed
>>>that Tapestry uses its own javascript functions to do form validation.
>>>Is it possible to change this to use my own validation package
>>>(fValidate)?
>>>
>>>
>>>
>>>      
>>>
>>Every validator that contributes client-side javascript validation will
>>let you override the IScript that it uses.
>>e.g.
>><bean name="stringValidator"
>>class="org.apache.tapestry.valid.StringValidator">
>>    <set-property name="scriptPath" expression="..."/>
>></bean>
>>
>>See the javadoc for the particular IValidator for details on
>>customizable attributes.
>>
>>    
>>
>>>I also noticed how the server side error messages are displayed. Is it
>>>possible to modify that as well? Like, could I just get a collection
>>>of errors and display them any way that I like on the page?
>>>
>>>
>>>
>>>      
>>>
>>Yes.  e.g.
>>
>><span jwcid="@Foreach" source="ognl:beans.delegate.fieldTracking"
>>value="ognl:fieldTracking">
>>    <span jwcid="@Conditional" condition="ognl:fieldTracking.inError">
>>       <span jwcid="@Delegator"
>>delegate="ognl:fieldTracking.errorRenderer"></span><br/>
>>    </span>
>></span>
>>
>>    
>>
>>>If these things are possible, is it a difficult thing to do. Like do I
>>>have to go in and modify actual tapestry code or is there a simple way
>>>I can introduce my own js validation library and define my own error
>>>message rendering?
>>>
>>>
>>>
>>>      
>>>
>>If you want to override the validation error text itself, that can also
>>be customized in the same way as described above for the script path.
>>
>>Paul
>>
>>    
>>
>>>Thanks
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>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: Form validation - customization

Posted by Ramin <i8...@gmail.com>.
Oh boy... I'm new to Tapestry coming from a purely jsp/jstl/servlets
world and this syntax is really scaring me. jwcid? ognl? man.. im
gonna have to get used to this..

within those span tags, would I be able to put regular html
attributes, like id="errors" or class="error"? and does it have to be
spans? could I use <ul> or any other tags?


On Fri, 25 Feb 2005 14:13:13 -0800, Paul Ferraro <pm...@columbia.edu> wrote:
> Ramin wrote:
> 
> >Going through the Tapestry tutorial on the appfuse wiki site I noticed
> >that Tapestry uses its own javascript functions to do form validation.
> >Is it possible to change this to use my own validation package
> >(fValidate)?
> >
> >
> >
> Every validator that contributes client-side javascript validation will
> let you override the IScript that it uses.
> e.g.
> <bean name="stringValidator"
> class="org.apache.tapestry.valid.StringValidator">
>     <set-property name="scriptPath" expression="..."/>
> </bean>
> 
> See the javadoc for the particular IValidator for details on
> customizable attributes.
> 
> >I also noticed how the server side error messages are displayed. Is it
> >possible to modify that as well? Like, could I just get a collection
> >of errors and display them any way that I like on the page?
> >
> >
> >
> Yes.  e.g.
> 
> <span jwcid="@Foreach" source="ognl:beans.delegate.fieldTracking"
> value="ognl:fieldTracking">
>     <span jwcid="@Conditional" condition="ognl:fieldTracking.inError">
>        <span jwcid="@Delegator"
> delegate="ognl:fieldTracking.errorRenderer"></span><br/>
>     </span>
> </span>
> 
> >If these things are possible, is it a difficult thing to do. Like do I
> >have to go in and modify actual tapestry code or is there a simple way
> >I can introduce my own js validation library and define my own error
> >message rendering?
> >
> >
> >
> If you want to override the validation error text itself, that can also
> be customized in the same way as described above for the script path.
> 
> Paul
> 
> >Thanks
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
- Ramin

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


Re: Form validation - customization

Posted by Paul Ferraro <pm...@columbia.edu>.
Ramin wrote:

>Going through the Tapestry tutorial on the appfuse wiki site I noticed
>that Tapestry uses its own javascript functions to do form validation.
>Is it possible to change this to use my own validation package
>(fValidate)?
>
>  
>
Every validator that contributes client-side javascript validation will 
let you override the IScript that it uses.
e.g.
<bean name="stringValidator" 
class="org.apache.tapestry.valid.StringValidator">
    <set-property name="scriptPath" expression="..."/>
</bean>

See the javadoc for the particular IValidator for details on 
customizable attributes.

>I also noticed how the server side error messages are displayed. Is it
>possible to modify that as well? Like, could I just get a collection
>of errors and display them any way that I like on the page?
>
>  
>
Yes.  e.g.

<span jwcid="@Foreach" source="ognl:beans.delegate.fieldTracking" 
value="ognl:fieldTracking">
    <span jwcid="@Conditional" condition="ognl:fieldTracking.inError">
       <span jwcid="@Delegator" 
delegate="ognl:fieldTracking.errorRenderer"></span><br/>
    </span>
</span>

>If these things are possible, is it a difficult thing to do. Like do I
>have to go in and modify actual tapestry code or is there a simple way
>I can introduce my own js validation library and define my own error
>message rendering?
>
>  
>
If you want to override the validation error text itself, that can also 
be customized in the same way as described above for the script path.

Paul

>Thanks
>  
>


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


Re: Form validation - customization

Posted by Kent Tong <ke...@cpttm.org.mo>.
Ramin <i8ramin <at> gmail.com> writes:

> I also noticed how the server side error messages are displayed. Is it
> possible to modify that as well? Like, could I just get a collection
> of errors and display them any way that I like on the page?

Please see my tutorial "validating input" at
http://www2.cpttm.org.mo/cyberlab/softdev/tapestry/index.html. It
shows you how to do that.




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


Re: Form validation - customization

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Feb 25, 2005, at 4:42 PM, Ramin wrote:
> Going through the Tapestry tutorial on the appfuse wiki site I noticed
> that Tapestry uses its own javascript functions to do form validation.
> Is it possible to change this to use my own validation package
> (fValidate)?

Yes, but you'd have to write your own IValidators to do this, I believe.

> I also noticed how the server side error messages are displayed. Is it
> possible to modify that as well? Like, could I just get a collection
> of errors and display them any way that I like on the page?

Yes, this is pretty easily accomplished by setting your own validation 
delegate.

> If these things are possible, is it a difficult thing to do. Like do I
> have to go in and modify actual tapestry code or is there a simple way
> I can introduce my own js validation library and define my own error
> message rendering?

You won't have to modify Tapestry internals, no.  But it won't be 
"simple", in that you'll have to dig into how Tapestry does this stuff 
and tie things together the way it likes.

	Erik


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