I am adding an additional field to allow the user to specify a photo caption before uploading. I want to make this filed a required input. I can;t find anything in the documentation the provides validation. So i have put together the following code
$('#fileupload').bind('fileuploadsubmit', function(e, data) {
var inputs = data.context.find(':input.form-control');
if (inputs.val() == "")
{
return false;
}
});
This allows me to check the value being passed by the caption field and asses it. if I return false it does stop the the form submitting. but it disables the upload button and this can't be re enabled.
Also I can't find a way of displaying an error message to the use.
Am I going about this the wrong way? is there in fact an method for doing client side validation on the additional form data that i have missed?
Thanks
EDIT
I forgot to mention in the main post. I am using the component https://github.com/blueimp/jQuery-File-Upload