[Last Call] Learn how to a build a cloud-first strategyRegister Now


Javascript disable button in parent form

Posted on 2007-09-27
Medium Priority
Last Modified: 2012-06-21
I have a parent window tha opens a child window. I would like to disable the button from the parent window only if child form is submitted successfully.
Question by:Cali123
LVL 23

Accepted Solution

basicinstinct earned 2000 total points
ID: 19975022
If you have a button like this in the parent window:

<input type="button" id="someId"/>

Then you can disable it from the child window like this:

window.opener.document.getElementById('someId').disabled = true;

Only your server side code knows if the form was submitted successfully, so on the child window have your server side code write the disable button script when it is rendering the child window after a successful form submission...

Expert Comment

ID: 19975402
I guess it all means on what you mean by "successful submit" of  the child window.

Have the child track if the page was submitted successfully. Have some hidden flag to identify this.
(I'm assuming that the child page comes back after a submit.)

Then based on that, set the button state of the opener as instructed above.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question