Changing The Value Of Input File
Solution 1:
You could store the file regardless of other validation errors in the form (obviously only if the file itself is valid), and then replace the file upload field with the file details (e.g. list the filename and size).
Actually rather than replacing the field, I'd recommend giving them the option to upload a different file in its place if they wish.
Solution 2:
Store the uploaded file on the server.
Generate a checkbox with a value that references an id associated with that file. Make it checked by default.
Tell the user to uncheck it if they don't want to reuse the same file.
Solution 3:
Using javascript you can prevent the form from being submitted until all fields are validated.
I recommend jQuery Validation Engine tutorial included. demos
Also you can add some style to the image uploader using jQuery file upload.
Of course some field must be verified on the server that's why you can post an ajax request with the validation engine.
"ajaxUserCall":{"url":"ajaxValidateFieldUser","extraData":"name=eric","alertText":"* This user is already taken","alertTextOk":" * User is valid","alertTextLoad":"* Validating, please wait"},
Some example with server side validation witout redirection or refreshing : Demo
Post a Comment for "Changing The Value Of Input File"