Jump to content
  • 0

Disabling a custom button based on NO event (state of page when loaded)



I've got a tabular data page with a custom button generated by this code in the header:

<div class="right99">
<input id="ContinueButton" type="button" value="Continue" class="cbDarkTwoLineButton" onclick="window.location.href='[@app:Launch]?uID=[@field:PharmacyUmbrellaID]"/>

In the footer, I'm trying to use Javascript to set the button to disabled.  Then I've got an "if" condition (that is working based on console log tests) that would re-enable it in certain cases.  I've tried a bunch of variations of the code to disable or enable the button with no luck:

Variation 1: 
let continuebutton=document.queryselector(".ContinueButton");
continuebutton.disabled = true;

Variation 2:
document.getElementById("ContinueButton").disabled = false;

Variation 3:
ContinueButton.disabled = false;

Variation 4:
button = document.querySelector('#ContinueButton');

const enableButton = () => {
    button.disabled = false;

Variation 5:
let button=document.getElementbyID('ContinueButton');
button.disabled= true;

What does work?  If I set the button to disabled in the html section, I get the desired behavior, so I'm pretty confident it's a javascript and not a css problem.  

Would greatly appreciate any suggestions!


Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Thanks, @PotatoMato!

When I started to share the full code... Well - my code was pretty messy... So I kept boiling it down and boiling it down to the bare minimum to disable the button.  And in the end I found out that I am an IDiot because I had typed getElementByID instead of getElementById...   

I really appreciate the response and the willingness to help - I think I've finally got it!


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...