Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8594635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:14:38+00:00 2026-06-12T00:14:38+00:00

I am trying to add some validation to a form just before it is

  • 0

I am trying to add some validation to a form just before it is submitted. Here is what I am using:

$('#add_upload').submit(function(e){

    var file = $('#realupload_1').val();
    var p_name = $('#p_name').val();
    var p_price = $('#p_price').val();
    var thumb = $('#realupload_2').val();
    var p_desc = $('#p_desc').val();

    if(file == ''){
        e.preventDefault();
        alert('Please select a valid product file');
    }else if(p_name == '' || p_name == 'ebook name'){
        e.preventDefault();
        alert('Please set a valid product name');
    }else if(p_price == '0.00' || Math.ceil(p_price) == 0){
        e.preventDefault();
        alert('Please set a valid price for your product');
    }else if(thumb == ''){
        alert('Please select a valid product image for your product');
        e.preventDefault();
    }else if(p_desc == '' || p_desc == 'Description...'){
        e.preventDefault();
        alert('Please add a description for your product');
    }else{
        //$('#submita').attr("disabled","disabled").val("Please wait....");
    }

});

The above works perfectly on Firefox and Chrome. However, I am having issues with IE9 – it gets to the else statement but it doesn’t submit the form! Once I press submit button again, it asks me to make sure my upload file field isn’t empty! I’ m not sure how it is clearing the value.

When I remove the above validation, the form submits fine. However, I need to validate first.

What I have tried:

  1. I have made sure form IDs are all unique
  2. I have made sure to name my submit button ID to something other “submit”
  3. I have added $(‘#add_upload’).submit(); in the else field.

The above didn’t make any difference.

I really appreciate help here as I have wasted 2 hours on this!

My problem is similar to this question but no definitive answer yet.

Here is the HTML if it helps.

Update

Well, I’ve narrowed the issue to this problem JS code:

$('#file_upload_1').click(function(){

    $('#realupload_1').trigger('click');

});

As you can see I am triggering a click to open the file dialog box. IE9 doesn’t seem to like this, it must be a security issue where a form won’t submit if the file input was triggered automatically.

Can anyone confirm this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:14:39+00:00Added an answer on June 12, 2026 at 12:14 am

    Security in IE9 won’t allow you to trigger the click on that input field manually.

    You could try and wrap the input in a Label, and then trigger the click on the label instead, that may work 🙂

    <label id="labelID" for="inputID">
         <input id="inputID" type="file" />
    </label>
    
    
    $('#labelID').trigger('click');
    

    Although I do agree with the other answers, there’s much better ways of doing what you are trying to achieve.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add some Input Validation in Classic ASP by using the function/code
I'm trying to add some validation to some form fields in a jQuery Mobile
I am trying to add some simple validation to my asp.net mvc form and
I am trying to add some validation for my registration form, but i can't
i am trying to add some realtime form validation for my registration page, however
I am trying to add validation to a form that is submitted by ajax,
I'm trying to add some validation on a form to add a contact and
I have decided to add some validation to my combobox, what I'm trying to
Trying to setup some validation on the add to cart button for the dropdown
I'm trying to add the jQuery Validation plugin to some websites and I'm running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.