cancel
Showing results for 
Search instead for 
Did you mean: 

External Form Rendering (What is the alternative in 5.8?)

swapnonil
Champ in-the-making
Champ in-the-making
Hi,

I just want to display the value of some process variables on a from that appears within a User Task. I am using Activiti 5.8 with the bundled Activiti Explorer.

I tried putting a vote.form in my bar archive and referenced it in my user task like this
<userTask id="voteTask" name="Vote to Promote" activiti:dueDate="${completionDate}" activiti:assignee="${assignee}" activiti:formKey="vote.form">
However, I was unable to display the contents of the form in the "Activiti Explorer".
The form itself is very simple
<h1>Please vote to Promote this Build</h1>
<p>
<h2>Build Details</h2>
<table>
   <tr>
      <td>Build Number: </td>
      <td>${buildNumber}</td>
   </tr>
   <tr>
      <td>Repository Location: </td>
      <td>${codeBase}</td>
   </tr>
   <tr>
      <td>Integration Server URL: </td>
      <td>${integrationServerUrl}</td>
   </tr>
   <tr>
      <td>Trial Username/Password: </td>
      <td>admin/admin</td>
   </tr>   
</table>
</p>
<p>
  Do you approve this?
  <select name="promoteBuild">
    <option value="yes">Yes</option>
    <option value="no">No</option>
   </select>  
</p>

The truth I learned is that; this kind of form rendering inside the "Activiti Explorer" is no longer supported.
http://forums.activiti.org/en/viewtopic.php?f=9&t=2288&start=0&hilit=External+Form+Rendering

So what is the alternative? I just want to print the value of some process variables inside a form. The section within the <table> open, close tags is all that I want to print along with the input fields. In other words I need to place some read only labels with their values evaluated at runtime.

I have read the documentation, with regards to external form rendering. I have actually ended up more confused than ever after reading it.

I have also seen people printing out values of process variables within the <documentation> tag. However the documentation tag solution won't work for me because I also need to include some rudimentary formatting.

With Regards
Swapnonil Mukherjee
4 REPLIES 4

trademak
Star Contributor
Star Contributor
Hi,

You can use form properties instead. Form properties are the new way of implementing user task forms since version 5.7.
Just look in the user guide for more information.

Best regards,

swapnonil
Champ in-the-making
Champ in-the-making
Hi,

I have tried using form properties and from what I understand I can use

1. string as a datatype which renders a label:textfield combination
2. date as a datatype which renders a label:datefield combination
3. enum as a datatype which renders a label:select box combination
4. long as a datatype which renders a label:textfield combination
5. boolean  as a datatype which renders a label:checkbox combination

My requirement is to simply display a label, with rudimentary formatting like bold and font size tags around it.

How can I do this using form properties?

nandoztx
Champ in-the-making
Champ in-the-making
I have same problem… activiti-explorer dont render ".form" files. activiti-explorer use GWT api to show view components. I'm using Primefaces with jsf2, in my project to render "<activiti:formProperty>" elements.
Like:

<activiti:formProperty id="postalCode" name="Cod Postal" type="postalCode"/>
I have an formProperty.xhtml where has defined this type:

<p:inputMask rendered="#{cc.attrs.formProperty.property.type.name == 'postalCode'}"
   mask="99999-999" value="#{cc.attrs.formProperty.property.value}"
   disabled="#{!cc.attrs.formProperty.property.writable}" />
And a extended class where override AbstractFormType methods

public class PostalCodeFormType extends AbstractFormType {
private static Logger log = Logger.getLogger(PostalCodeFormType.class);

  public PostalCodeFormType() {
    log.debug("PostalCode Property Type initialized");
  }
 
  @Override
  public String getName() {
    return "postalCode";
  }

  @Override
  public Object convertFormValueToModelValue(String propertyValue) {
    if (propertyValue==null || propertyValue.equals("")) {
      return null;
    }
    return new Long(propertyValue);
  }

  @Override
  public String convertModelValueToFormValue(Object modelValue) {
    if (modelValue==null) {
      return null;
    }
    return modelValue.toString();
  }

  @Override
  public String toString() {
    return getName();
  }
}
In my ApplicationContext I have:

<property name="customFormTypes" >
      <list>
        <ref bean="postalCodeFormType"/>
      </list>
</property>
It works fine!

but I have an problem with "enum" type mapped to "selectOneMenu" primefaces element:
my code is:

<p:selectOneMenu rendered="#{cc.attrs.formProperty.property.type.name == 'enum'}" value="#{cc.attrs.formProperty.property.value}" disabled="#{!cc.attrs.formProperty.property.writable}">
       <f:selectItems value="#{cc.attrs.formProperty.information}" />
     </p:selectOneMenu>
in workflow:

<activiti:formProperty id="direction" type="enum">
      <activiti:value id="left" name="Go Left" />
      <activiti:value id="right" name="Go Right" />
      <activiti:value id="up" name="Go Up" />
      <activiti:value id="down" name="Go Down" />
    </activiti:formProperty>
It,s return null values….
Anybody can help me with this?
Is a bug?

Thank's in advance!

nandoztx
Champ in-the-making
Champ in-the-making
Hi everybody!
About 'null' values from 'enum' element.
I solved this, was a bug in my source when I need transform FormProperties to a Map.
If formProperty is an enum: catch ID;

for(String key: values.keySet()) {
                        //if(value == values.get(key)){ -> wrong comparation
   if(value.equals(values.get(key))){
    return key;
   }
  }
So… it works