cancel
Showing results for 
Search instead for 
Did you mean: 

Adding custom js to model created through Model Manager

jakeer
Champ on-the-rise
Champ on-the-rise
I have created a model using Model Manager. In the model I have created one Aspects with custom fields. I added this Aspect to a file through "manage Aspect" option. There is 5 drop downs in the Aspect's form like domain, php, java, oracle and dot net. If user select a value in domain drop down, based on the value selected that respective drop down will display and others will be hidden.

Eg: If I have 3 drop downs like domain, php, java

Initially php and java drop downs will be hidden. Under domain we have below values

php
java

if user selects php, then php dropdown will display and other will hidden
if user selects java, then java dropdown will display and other will hidden

I am looking for this kind of functionality. If any one knows, please guide me how to achieve this

I am using Alfresco Community - 5.1.0 (r122274-b3) version and ubuntu operating system

Thanks in Advance
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
There are many different ways you could implement this. Unfortunately, none of them are point-and-click via the form designer or form layout tool in the GUI with 5.1. You'll have to do it with a small customization and some client-side JavaScript.

One approach is to use the Share form configuration XML to point each of those three fields at a custom form control. Custom form controls are just freemarker templates, which are kind of like JSPs.

On the custom form control, you can add some JavaScript. That JavaScript can use something like JQuery to manipulate the DOM based on the values selected. For example, you could have a function that binds to the dropdown's onChange event, and then shows or hides the DIVs that wrap the other two fields accordingly.

If you or someone on your team knows JavaScript and JQuery, this should be a fairly straightforward little customization.

Jeff