Paul
Paul

Reputation: 141

Alfresco Community edition-5.1 in workflow form text field show and hide for conditions

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?

Upvotes: 2

Views: 192

Answers (2)

Vikash Patel
Vikash Patel

Reputation: 1346

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>

Upvotes: 0

Akah
Akah

Reputation: 1920

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

Upvotes: 0

Related Questions