The CreatorCon Call for Content is officially open! Get started here.

Disable a button or make it readonly

Not applicable

Hi , I have added a new button on the form and its corresponding action. works good. I need to make it appear active conditionally on the form but not hide it. Just to make it disabled when the condition does not meet and not completely hide. Instead, show it but should not be active.
something like if(condition) (button.disabled=true) else (button.disabled=false)
I know this can be achieved through script, but how to grab the button id/name.

Thanks,
Shiva

14 REPLIES 14

One question, any idea how to remove the button using this script from both the header and the actual bottom part of the form?


Can you just adjust the UI Action condition, so that the button does not get rendered?

This sounds like a different question, so if it is unrelated, please create a new topic, and post the link here.


Hi Valor, thanks for the response... yes you can add it to the Condition field on the actual UI action. I forgot you could use 'current' on that condition. Thanks


poornima2
Mega Expert

Shiva,
Try this....

This disables the submit button onLoad
function onLoad() {
var refs = document.getElementsByTagName("BUTTON");
if (refs) {
for (var i=0; i < refs.length; i++) {
var ref = refs;
var inner = ref.innerHTML;
if (inner == 'Submit'){
ref.disabled = true;
}
}
}
}


Valor1
Giga Guru

Thanks, Jay!