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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:09:09+00:00 2026-05-23T18:09:09+00:00

I have a submit form for a URL and I want it to have

  • 0

I have a submit form for a URL and I want it to have specific behavior which I am not able to achieve so far. Initially I want the button to be enabled. After someone enters a URL and hits the “submit” button, I want to call my checkURL() function. If the function returns true, I want the button to become disabled and I want to then open remote_file.php. If it returns false, I want the button to be enabled and make them try another URL.

<form name=URLSubmitForm
    action="remote_file.php" 
    method="post">

    <input type="hidden" name="MAX_FILE_SIZE" value="524288000">
    <input type="text" name="name" size="50">
    <input type="submit" 
        onchange="this.disabled=false"
        onclick="this.disabled=true; checkURL();"
        value="submit">
</form>

Edit: It looks like I was just putting the onchange in the wrong place. I ended up doing this to fix reenabling the button

<input type="text" onchange="submit.disabled=false" name="name" size="50">

Thanks!

  • 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-05-23T18:09:09+00:00Added an answer on May 23, 2026 at 6:09 pm

    I would propose that you attach the event handling code to the form’s onsubmit event, not the button event(s). What you’re trying to control is whether or not the form is posted. The button being disabled while your validation logic runs is a secondary goal.

    Try this instead:

    <script type="text/javascript">
    function checkURL(){
        var submitButton = document.getElementById('submitButton');
        submitButton.disabled=true;
    
        /* implement your validation logic here
        if( url is invalid ){
            submitButton.disabled=false;
            return false;
        }
        */
    
        // everything is valid, allow form to submit
        return true;
    }
    </script>
    
    <form name="URLSubmitForm" action="remote_file.php" onsubmit="return checkURL();" method="post">
            <input type="hidden" name="MAX_FILE_SIZE" value="524288000">
            <input type="text" name="name" size="50">
            <input type="submit" name="submitButton" id="submitButton" value="submit">
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form, when user submit the form, I want to direct the
I want to submit a form that have many checkboxes with different values, using
I have a form with an input element but no submit button. I use
I want to submit a form with an anchor instead of a button. Here
I've bound a function to a form submit button. I want the function to
I have a form, with a text input and a submit button. On submit,
Possible Duplicate: Disable submit button on form submit I have a question about disable
I have two submit button on my form, Save and Cancel: <p> <input type=submit
I have a simple ExtJs form panel which contains a fileuploadfield. When I submit
i have have a form in site A and want to submit the form

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.