2

I am using Alfresco Community Edition 5.1.x. I have created a workflow using kick-start where I have used drop-down list.

When selecting the drop-down value, text-field should be enabled based on conditions otherwise the text-field is not showing in workflow form.

Is this possible? And how?

abarisone
  • 3,707
  • 11
  • 35
  • 54
Paul
  • 141
  • 1
  • 11

2 Answers2

0

I've had the same problem. I've seen two choices :

  1. Make the select choice a step in the workflow (you chose, you click next and the form appears)
  2. You do it in javascript (what I have done). You put a callback on your select, and use jQuery show() and hide() functions. If you have mandatory fields, you nedd to handle that too.

This is what I've done and it worked, but I would be glad if anyone have a more elegant solution.

Edit : in my case, I was making a custom component, and then had a template (ftl) and a script file (js). In this js, once the page is initialized, I added a section of code to handle what I need. The code I'm putting is just for the example :

$('#select_id').change(function(){
        showHideMyComponent($(this).val());
});

function showHideCible(value){
        boolean hide = checkIfIhaveToHide(value);
        if(hide){
            $("#divToHandle").hide();
        }else{
            $("#divToHandle").show();
        }
    }
Akah
  • 1,890
  • 20
  • 28
  • @KrutikJayswal What do you mean ? – Akah May 18 '16 at 06:36
  • 1
    Alfresco is CMS..there are lot many things to do..for this..its not only javascript sho and hide() – Krutik Jayswal May 18 '16 at 06:37
  • My solution is working, I'm showing/hiding parts of the form based on a sélect event by using JavaScript on my project. It works, even if I would like à builtin solution provided by alfresco. – Akah May 19 '16 at 06:03
  • Hi All, Above Java Script code is not working in pop-up. is there any solution for this. – Deepak Talape Jun 21 '16 at 06:46
  • Is your js included in the page ? Could you please edit your question with your code ? – Akah Jun 21 '16 at 07:59
  • My js code is there in the ftl file. that js code is not working only in case of pop-up. I also make a new question regarding this. please refer below link. http://stackoverflow.com/questions/37921968/java-script-code-is-not-working-in-property-page-pop-up?noredirect=1#comment63294704_37921968 – Deepak Talape Jun 21 '16 at 11:24
0

You can create a custom FTL which will display the form fields according to dropdown selection And you have to give the path of that ftl as your field id

<field id="xxx:propName" set="info"> <control template="/org/alfresco/components/form/controls/xyz.ftl" /> </field>

Vikash Patel
  • 1,328
  • 9
  • 28