[jQuery] Validation Plugin - How to Validate input="file"
I'm trying to validate that someone has selected a file for upload
before submitting a form. I set the required class on the input
element, but it's not being validated. The regular text input is
validated, however.
<form:form id="pictureform" commandName="pictureCommand"
action="${actionURL}" method="post" enctype="multipart/form-data"
cssClass="update">
<div>
<label for="title">
Title:
</label>
<form:input path="title" cssClass="required" />
</div>
<div>
<label for="description">
Description:
</label>
<form:textarea path="description" />
</div>
<label for="image">
Select File:
</label>
<input type="file" name="image" cssClass="required" />
<input type="submit" value="Add" />
</form:form>