Conditionally disable button

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

16 Dec 2016

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

YuriyMedvedev
Moderator
Posts: 33
Joined: Wed Sep 21, 2016

19 Dec 2016

Hi, use this code

function ButtonDisable() {

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

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

}

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

ButtonDisable();

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

19 Dec 2016

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests