Alfresco Share has very flexible form customization and allows developer to go wild with settings, but a problem emerges when developer wants to make one form control depended of other. We are going to show a simple one with our type ab:invoice that we previously wrote about. ab:invoice type has two properties one is the invoice value and other is invoice high indicator. If invoice value is more than $1000 we want high indicator to be checked. Same principle shown here can be applied with combo boxes, date selectors and so on. We must say that this problem mentioned here can be solved using custom behaviours.
Lets see share form config
Everything seems normal except part for invoiceValue, it has some custom properties and new number.ftl template. Custom properties used here are
- otherInput, specifies what is the type or aspect property that value should be applied
We have defined custom number.ftl for this case so lets see important part of the code
Although this solution is fine and would work it has a problem with maintenance, we have to have 100% of number.ftl in order to make this work. Better way would be to include number.ftl and then using YUI library to connect events like onKeyUp and call the method. We will go through that idea in some future posts.