Ajaxloading image shows even when form has validation error!

Can anyone please help with the following.
I have an email attachment form which I have set up.
It is set up so that it has a few fields which are required fields and others which are optional.
The form works fine and sends the attachment etc.

The issue is that when someone chooses to send a large file attachment they think the form doesn’t work because it takes longer to process.
I’ve added an ajax loading image which works fine and should solve the issue but I obviously have the code in the wrong place on the page becasue the loading image shows whenever I click the submit button and I only want it to show once the form has been checked for validation errors. If the form finds no validation errors it shoudl then show the code.

Can anyone help with this please?
Here’s an example of the file thats causing the problems:

http://www.fennultdesign.co.uk/minuteman-press/test/send-file.php

Any help would be greatly appreciated with this. Thanks in advance.

Can anyone out there help please?
Instead of this kaku newton who clearly doesn’t have a clue!

First of all get rid of that onclick event for the submit button.

The validator that you’re using doesn’t seem to allow you to excute other code before the form is submitted. Other form validators have a submitHandler to which you can assign other code.
So with your own form validation script there, you could instead add a custom form validation, which will get executed after all of your other form validations have successfully passed.

It might look something like this:


frmvalidator.setAddnlValidationFunction("loadSubmit");

Hi Paul

Thanks very much for the reply. Can you help me as to where I should put the javascript code? I’m struggling a bit with this and need to get it working ASAP. Would really appreciate the help here.

Thanks in advance.

You can put it with the rest of the code that sets up your validation requirements.