You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Piero Sartini <li...@pierosartini.de> on 2009/12/06 21:10:24 UTC

Customize markup of client side validation

Hello,

I want to overwrite the markup that is generated from tapestry for client side 
validation. To be more detailed, I need to integrate the forms.css of the YAML 
css framework:
http://www.yaml.de/en/dokumentation/css-bausteine/formularbaukasten.html

To use it the right way, it is not enough for me to overwrite the .t-error and 
.t-error-icon styles, but I need to change what markup is generated if there 
is an error.

Also I want to get rid of the popup boxes. The final markup should look like 
this:
---- code ----
<div class="type-text error"> 
                <strong class="message">My error message!</strong> 
                <label for="fieldName">FieldText</label>
                <input type="text" name="fieldName" id="fieldId" size="20"/> 
</div> 
---- code ----


What would you suggest how to accomplish this?

Thanks in advance,

	Piero

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


Re: Customize markup of client side validation

Posted by Piero Sartini <li...@pierosartini.de>.
> You would need to implement your own ValidationDecorator. I just thought
> of it yet. It would be a better solution to your specific problem. There
> were some messages in this mailing list about it. The Tapestry sources are
> other nice places to see some examples about it.

ValidationDecorator looks like the right tool for the job, thanks a lot!

	Piero

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


Re: Customize markup of client side validation

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Sun, 06 Dec 2009 20:52:17 -0200, Piero Sartini <li...@pierosartini.de>  
escreveu:

> Hi Thiago,

Hi!

> Thanks for the hint. I've thought in this direction as well but was not  
> sure if it would be possible at all. I like the mixin strategy because  
> writing myown components seems to duplicate lots of the  
> tapestry-components.. or do I miss s.th.?

You would need to implement your own ValidationDecorator. I just thought  
of it yet. It would be a better solution to your specific problem. There  
were some messages in this mailing list about it. The Tapestry sources are  
other nice places to see some examples about it.

> About the mixin I have some questions:
>  * where would you add it? On the fields or on the form?

It would be easier in the fields.

>  * How do I remove / replace the tapestry-generated error popups with  
> the in-place error message?

I don't know, but maybe you can use CSS for that.

>  * Do I need to re-invent the client-side stuff?

I don't know.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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


Re: Customize markup of client side validation

Posted by Piero Sartini <li...@pierosartini.de>.
Hi Thiago, 

> I can think of two ways: using your own component to get the validation
> errors from the ValidationTracker or write a mixin that rewrites the
> generated DOM.

Thanks for the hint. I've thought in this direction as well but was not sure 
if it would be possible at all. I like the mixin strategy because writing my 
own components seems to duplicate lots of the tapestry-components.. or do I 
miss s.th.?

About the mixin I have some questions:
 * where would you add it? On the fields or on the form? 
 * How do I remove / replace the tapestry-generated error popups with the in-
place error message?
 * Do I need to re-invent the client-side stuff?

Lots of questions, sorry...

Best regards,

	Piero


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


Re: Customize markup of client side validation

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Sun, 06 Dec 2009 18:10:24 -0200, Piero Sartini <li...@pierosartini.de>  
escreveu:

> Hello,

Hi!

> I want to overwrite the markup that is generated from tapestry for  
> client side validation.

I can think of two ways: using your own component to get the validation  
errors from the ValidationTracker or write a mixin that rewrites the  
generated DOM.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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