Page 1 of 1

How can I set custom behavior for status field?

Posted: 11 Nov 2012
by JustinTim
Hi, I have tried your product, it is useful when I need to place fields in custom order on different tabs. I used it to customize our intranet stationery requests system. But I need little bit more complex behavior. I have Choice field, named State. User can choose "New", "Applovement", "Execution", "Done" states. I need to use some cusom validation, for example, when user creates new request it can't set state field value to the Execution or any other state, exept "New". How can I implement it?

Re: How can I set custom behavior for status field?

Posted: 12 Nov 2012
by Anthony (Support)
JustinTim,

You can use JavaScript button in the ribbon of Form Designer. It is possible to use jQuery, just put in the input window code like this:

//Get current State value
$(document).ready(function () {
prevState = fd.field('State').control().value();
});

//Subscribe for State field changes
fd.field('State').control().change(function () {
var v = fd.field('State').control().value();

//If user tried to set Execution state after New, do something
if (prevState == 'New' && v == 'Execution') {
alert('You cant set Execution state without passing Approvement state')
}
});

Re: How can I set custom behavior for status field?

Posted: 18 Nov 2012
by JustinTim
Thanks, I finally did it, now I'll try to play with more complex behaviors)