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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:11:05+00:00 2026-05-23T21:11:05+00:00

I need to update an application so that when a user clicks on a

  • 0

I need to update an application so that when a user clicks on a button, etc all of the input fields become disabled. Here is what I have so far for the javascript. The following works and everything, so no worries there.

function disableAllInputs() {
    var inputs = getAllInputs();
    for (i = 0; i < inputs.length; i++) {
        inputs[i].disabled = true;
    }
}


function enableAllInputs() {
    var inputs = getAllInputs();
    for (i = 0; i < inputs.length; i++) {
        inputs[i].disabled = false;
    }
}

function getAllInputs() {
    var inputs = document.getElementsByTagName('input');
    var selects = document.getElementsByTagName('select');

    var allInputs = new Array();

    var counter = 0;
    for (i = 0; i < inputs.length ; i++) {
        allInputs[counter] = inputs[i];
        counter++;
    }
    for (i = 0; i < selects.length; i++) {
        allInputs[counter] = selects[i];
        counter++;
    }

    return allInputs;
}

Now, in my HTML I basically have this:

<form name="MyForm" method="post" action="MyAction.do" onsubmit="onSubmit();">
    //form code
    <input type="submit" value="Save" name="submit" onclick="onSaveClick()" >
</form>

Everything appears to work fine. However, I need to make it all testable. I’d like to put in a delay so that everything freezes and the tester can make sure everything is disabled, etc. But this pausing should be temporary and immediately removable without any possible side effects (i.e. it would be nice to call a pause() function and then just delete the call).

Here are some issues:

1 – If I call the disableAllInputs method in the onSaveClick method, the form does not submit (I assume because the button was disabled).

2 – If I call the disableAllInputs method in the onSubmit method, the pausing does not appear to work.

Can anyone think of an way to seamlessly pause the form submission after the buttons are disabled? I am aware of setTimeout, etc. I just can’t find an appropriate call location, etc to use. Nothing seems to pause the form AND eventually submit the form.

Also, I’d have the JS in a separate .js file, so it would be nice if I could just include the file and add the disableAllInputs method where appropriate (that is, I’d like to avoid doing a timeout on the onSubmit method, etc).

  • 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-23T21:11:06+00:00Added an answer on May 23, 2026 at 9:11 pm

    Well, you can insert a pause using various methods, but all of those methods will cause the entire page to become unresponsive during the pause. The simplest example of this would be an alert box. (You could also use SJAX – Synchronous AJAX.)

    You could stop the code by triggering a fatal error, such as calling a function that doesn’t exist. stopJavascript(); But that wouldn’t allow the code to continue anymore.

    The only other option would be to split the function up into two functions and use a setTimeout to delay the calling of the second function after the first. However, this would be harder to implement and harder to remove.

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

Sidebar

Related Questions

I have an Access application in which I need to do a 'mass-update'. I
I need to update a record in a database with the following fields [ID]
I have a table of about a million rows and I need to update
I need write an update statement that used multiple tables to determine which rows
I have a Zimbra installation and I need to programmaticaly update contacts in it.
I'm currently working with a part of my application that uses Dynamic Web User
I have an application that I'm currently building that requires me to display a
I have an application that start System.Threading.Timer, then this timer every 5 seconds read
i have a input tag which is non editable, but some times i need
Possible Duplicate: How can I write a Java application that can update itself at

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.