You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Eugene Prigarov <Eu...@enterra-inc.com> on 2004/03/16 05:28:15 UTC

ValidTextArea and ValidUpload components

Hi! 

Sure, I have developed UploadValidator implementing the IValidator for
file name validation (for textarea I used standard string validator).
This is not a problem.

But ValidField extends AbstractTextField.

 

The AbstractTextField contains this code:

protected void  renderComponent (IMarkupWriter writer, IRequestCycle
cycle)

{

...

        writer.beginEmpty("input");

 

        writer.attribute("type", isHidden() ? "password" : "text");

...

}

 

This is the problem. It renders only "input" tag! The ValidField can't
be customized outside the source code to render the "textarea" html tag,
or render "file" input instead "text" and "password".

I suppose the solution is to add property "tag" (or something else)
maybe two properties "tag" and "type" for ValidField component and
modify ValidField.renderComponent() method. For example:

 

<textarea jwcid="@ValidField"  

validator="ognl:beans.textAreaValidator"  

displayName="ognl:'text areat text input'" 

validator="ognl:beans.textAreaValidator" 

value="ognl:areaValue" 

tag="textarea"/>.

 

Or include ValidTextArea and ValidUpload components with overridden
renderComponent() method in contrib library.  The second way is prettier
in my opinion. 

 

Am I wrong? If there is another way to add validation ability to
TextArea and Upload components please let me know about it.