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 8115701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:33:21+00:00 2026-06-06T03:33:21+00:00

I have an issue in my JavaScript function. Below is my js code: function

  • 0

I have an issue in my JavaScript function.

Below is my js code:

function abc(formobject){
    var ext =".txt";
         var abc=".doc,docx";
    if(abc.search(ext) < 0){
        alert("hi"); 
        formobject.file.value="";
        return false;
    }
    return true;
}

<input type="submit" id="button"  value="submit" onclick="return abc(this.form);">

Here on click of submit button I am calling abc() js function and uploading the file. It executes the logic and if the file is of not valid extension it should throw alert and clear the values of browse button. Its happening in Mozilla, but the values are not getting cleared in IE8. Can anyone help me on this?

File is the <html:file property="file"/> which I am uploading here.

  • 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-06T03:33:22+00:00Added an answer on June 6, 2026 at 3:33 am

    Instead of

    formobject.file.value=""; 
    

    try using

    formobject.reset();
    

    Hope this helps.

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

Sidebar

Related Questions

I'm having an issue with rails involving javascript. Basically, I have the following code:
I have a question and an issue wrt the code below: My question is
I have an issue with this jquery code below. Please give me advice or
I have an issue in making datepicker regional. <script type=text/javascript> $(document).ready(function () { $(function
I have an issue in image validation using jQuery Or JavaScript. Please see code
I have an issue with JQuery in IE7/IE8. My Code below is in the
Having a slight Javascript issue at the moment, I am hoping to have the
I have a little problem with javascript form submit issue, here is the script
I have a strange issue with my code I can't seem to figure out.
Requirement : I have a piece of code similar to the code below. I

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.