Question


I am trying to use Pure PHP Upload 2 and have a spry validation. I cannot get the validation to work.

Answer


The issue is that the Pure PHP Upload onSubmit code is overriding the Spry validation call.

Solution:

Change the Form onsubmit from:
onsubmit="checkFileUpload(this,'',true,'','','','','','','');return document.MM_returnValue"
to:
onsubmit="
if (Spry.Widget.Form.validate(this)) {checkFileUpload(this,'',true,'','','','','','','');return document.MM_returnValue;} else {return false;}"


Basically, it says if the form is valid, run the upload code, otherwise return false (which cancels the submit).