You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2008/08/28 11:10:51 UTC
T5: Tapestry-upload and onValidationForm
Hi,
I have a file upload form that requires user to encode a caption, I'm
trying to validate it on onValidateForm, but this is called after file has
been uploaded,
is there a way to check first the caption before uploading taking place?
this will save time.
Angelo
< t:form t:id="upload_form">
<input t:type="upload" t:id="file" size="40" validate="required"/><br/>
<input t:type="textfield" t:id="caption" size="40" maxlength="40" /><br/>
<input t:type="submit" value="Upload" name="submit" t:id="submit"
<t:errors/>
< /t:form>
@Property
private String caption;
@Component
private Form upload_form;
void onValidateForm() {
if (!caption) {
upload_form.recordError("caption is empty");
}
}
--
View this message in context: http://www.nabble.com/T5%3A-Tapestry-upload-and-onValidationForm-tp19196916p19196916.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: T5: Tapestry-upload and onValidationForm
Posted by Jonathan Barker <jo...@gmail.com>.
I haven't used the upload component, but the usual way would be to use
"validate:required,minlength=3" or something similar in your textfield and
rely on client-side validation.
> -----Original Message-----
> From: Angelo Chen [mailto:angelochen960@yahoo.com.hk]
> Sent: Thursday, August 28, 2008 05:11
> To: users@tapestry.apache.org
> Subject: T5: Tapestry-upload and onValidationForm
>
>
> Hi,
>
> I have a file upload form that requires user to encode a caption, I'm
> trying to validate it on onValidateForm, but this is called after file has
> been uploaded,
> is there a way to check first the caption before uploading taking place?
> this will save time.
>
> Angelo
>
> < t:form t:id="upload_form">
> <input t:type="upload" t:id="file" size="40"
> validate="required"/><br/>
> <input t:type="textfield" t:id="caption" size="40" maxlength="40"
> /><br/>
> <input t:type="submit" value="Upload" name="submit" t:id="submit"
> <t:errors/>
> < /t:form>
>
> @Property
> private String caption;
>
> @Component
> private Form upload_form;
>
> void onValidateForm() {
> if (!caption) {
> upload_form.recordError("caption is empty");
> }
> }
> --
> View this message in context: http://www.nabble.com/T5%3A-Tapestry-upload-
> and-onValidationForm-tp19196916p19196916.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org