• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 901
  • Last Modified:

Javascript disable button in parent form

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.
1 Solution
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...
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now