Page 1 of 1

Conditionally disable button

Posted: 16 Dec 2016
by Katy
I am trying to make a button disable when the status field is Completed, I found this tread :

viewtopic.php?f=1&t=403

and here is my code:



function ButtonDisable() {
if (fd.field('Satus').value() == 'Completed') {

$('.approve-button').prop('disabled', true);
} else {

$('.approve-button').prop('disabled', false);
}
}
fd.field('Satus').change(ButtonDisable);
ButtonDisable();

but it is not working L

Re: Conditionally disable button

Posted: 19 Dec 2016
by YuriyMedvedev
Hi, use this code

function ButtonDisable() {

$('.approve-button').prop('disabled',

(fd.field('Title').value() != 'Completed'));

}

fd.field('Title').change(ButtonDisable);

ButtonDisable();

Re: Conditionally disable button

Posted: 19 Dec 2016
by Katy
Thanks Yuriy! It works. Just changed != to ==, as it was disabling the buttons when the status is not completed :-)