How can I set custom behavior for status field?
Posted by JustinTim - Nov 11 ’12 at 03:58
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?
-
Anthony (Support)ModeratorMember for: 7 years 1 month 5 days
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')
}
}); -
JustinTimMemberMember for: 7 years 1 month 3 days
Thanks, I finally did it, now I'll try to play with more complex behaviors)