views:

271

answers:

1

I have a form which has got five (5) file input controls along with other controls. This form also has got two (2) submit buttons.

I have used JQuery Validation plugin to validate form inputs.

Name of one submit button is "Upload_Images" and name of another is "Upload_Project".

What I want to do is that if user clicks on "Upload_Images" button all files controls should be validated and files uploaded to server but not rest of the data.

If use clicks on "Upload_Project" button then the whole form should be validated and the files are not already uploaded they should be first uploaded and then the project should be saved to DB.

Now if I click on any of the two submit buttons the form Validation kicks in and if there is invalid data it stops form submit process.

How can I achieve this?

+2  A: 

Use javascript to change your form 'Action' property to redirect to wherever other page you need to go, then submit.

David Brunelle
It does not get redirected to any other page. It stays on same page.If a user clicks on "Upload_Images" only the images should be uploaded the page is refreshed. But the problem is that Validation script kicks in and aborts the submit process if the user has not entered any data in other required fields.My question is how can we prevent this when "Upload_Images". Again validation should work as expected if the user clicks on "Upload_Project".
Yogi Yang 007
I never used JQuery before, but I believe it's Javascript base. I did a quick check on the validation process and it seems all you do is define css class to objects you want to validate. Why not chagne the css class to something that does not validate , THEN submit. I believe this should do the trick.
David Brunelle
I will look into this idea. And if I am successful I will get back and also close this question.Thanks for the hint.
Yogi Yang 007