SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question 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/minut.../send-file.php


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

  2. #2
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can anyone out there help please?
    Instead of this kaku newton who clearly doesn't have a clue!

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,683
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by sketchgal View Post
    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:

    Code javascript:
    frmvalidator.setAddnlValidationFunction("loadSubmit");
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,683
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by sketchgal View Post
    Can you help me as to where I should put the javascript code?
    You can put it with the rest of the code that sets up your validation requirements.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •