How can I set custom behavior for status field?

Discussions about Forms Designer for SharePoint 2010.
Locked
JustinTim
Posts: 3
Joined: Thu Nov 15, 2012

11 Nov 2012

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?

User avatar
Anthony (Support)
Moderator
Posts: 11
Joined: Sat Nov 17, 2012

12 Nov 2012

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
Posts: 3
Joined: Thu Nov 15, 2012

18 Nov 2012

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 27 guests