How can I set custom behavior for status field?

rss

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)
    Anthony (Support)
    Moderator
    Member for: 6 years 7 months 10 days
    #1 by Anthony (Support) Nov 12 ’12 at 02:00

    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')
    }
    });

  • JustinTim
    Member
    Member for: 6 years 7 months 8 days
    #2 by JustinTim Nov 18 ’12 at 02:40

    Thanks, I finally did it, now I'll try to play with more complex behaviors)

Displaying 1 to 2 of 2 messages