You might have more luck posting this on the struts user list.

Cheers,
Lance.

-----Original Message-----
From: Fleetwood, Brett (DCS) [mailto:[EMAIL PROTECTED] 
Sent: 24 January 2007 07:17
To: commons-user@jakarta.apache.org
Subject: using struts validator for a form-property of 
type="org.apache.struts.upload.FormFile"

G'day All,
 
I'm trying to validate a form that contains a
org.apache.struts.upload.FormFile as a form property on a JSP. From the
struts HTML tag-lib I'm using <html:file> in my JSP like this;
<html:file size="80" property="fileUpload" styleClass="inputfield"
errorStyleClass="inputfielderror" />

and I've set up the form bean like this;

<form-bean name="documentUploadForm" dynamic="true"
type="au.gov.sa.dcs.dcscommon.ui.struts.form.DcsDynaValidatorForm">

    <form-property name="fileUpload"
type="org.apache.struts.upload.FormFile"/>

    <form-property name="documentIndex" type="java.lang.String" />

    <form-property name="personIndex" type="java.lang.String" />

    <form-property name="documentType" type="java.lang.String" />

    <form-property name="documentAttributeDescription"
type="java.lang.String" /> 

</form-bean>

where the DcsDynaValidatorForm extends the DynaValidatorForm.

I'm trying to validate the form by checking the text of the FormFile
object to see if its blank. This is what i've tried in validation.xml
but it doesn't get picked up;

<field property="fileUpload" depends="required" >

    <arg key="File" resource="false" position="0" />

</field>

I'm quite new to this and if i've omitted anything then please let me
know. 

Thanks in advance,

Brett.

 

 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to