cancel
Showing results for 
Search instead for 
Did you mean: 

External form render problem

firebird0001
Champ in-the-making
Champ in-the-making
Hi,

I have a problem using external forms. I've just started learning Activiti, so I may misunderstand something. Anyway…

I've created some test project, based on VacationRequest sample. When I try to add external form to user task using activiti:formKey="request.form" (it is in the same package) nothing happens. It renders only empty form with only button Complete task. Where might be the mistake?

Thanks in advance for any help!
6 REPLIES 6

warden
Champ in-the-making
Champ in-the-making
Hi!

As you can see in this post http://forums.activiti.org/en/viewtopic.php?f=9&t=2288
The old forms are not supported anymore in the new Activiti Explorer.

Reading user guide I understand that External form rendering now is only possible if you use API, please is this right?

Regards

firebird0001
Champ in-the-making
Champ in-the-making
Ok, I've got another problem. I tried to create my form property of my own type (double), I successfully deployed it to activiti-engine test app and deployed a process with it. But when I start the process, this property isn't displayed. By the way, "Confirm task" button isn't displayed also.

package org.activiti.newformtypes;

import org.activiti.engine.ActivitiException;

public class DoubleFormType extends AbstractFormType {

public String getName() {return "double";
}

public String getMimeType() {return "plain/text";
}

public Object convertFormValueToModelValue(String propertyValue) {…}

public String convertModelValueToFormValue(Object modelValue) {…}
}

where might be the problem?

trademak
Star Contributor
Star Contributor
Hi,

Is there anything shown in the log file?
It would be good to show the full code else it's difficult to think about the reason.

Best regards,

firebird0001
Champ in-the-making
Champ in-the-making
I haven't found any errors in tomcat log files… (maybe I'm looking in the wrong place?)

So… I took Vacation request example process and changed the type of one of the fields from long to double.

<userTask id="handleRequest" name="Handle vacation request">
     <extensionElements>
      <activiti:formProperty id="comment" name="Comment" type="double" required="false"/>
     </extensionElements>
      <potentialOwner>
        <resourceAssignmentExpression>
          <formalExpression>management</formalExpression>
        </resourceAssignmentExpression>
      </potentialOwner>
    </userTask>

I took LongFormType and changed it to fit Double type

public class DoubleFormType extends AbstractFormType {

@Override
public String getName() {
  return "double";
}

public String getMimeType() {
     return "plain/text";
}

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

@Override
public String convertModelValueToFormValue(Object modelValue) {
  if (modelValue==null) {
         return null;
       }
  if(Double.class.isAssignableFrom(modelValue.getClass())
             || double.class.isAssignableFrom(modelValue.getClass())) {
       return modelValue.toString();     
     }
     throw new ActivitiException("Model value is not of type boolean, but of type " + modelValue.getClass().getName());
}
}

Then I created NewProcessEngineConfiguration and reimplemented init() method inserting new DoubleFormType

@Override
public void init()
{
  …
  initFormTypes();
  formTypes.addFormType(new DoubleFormType());
  …
}

I exported this classes to .jar and placed in into activiti-engine libs folder. I've changed processEngineConfiguration value in applicationContext.xml to make activiti-explorer use my process engine configuration.
Then I successfully deployed my process to activiti explorer and got a trouble with displaying this form property.

jbarrez
Star Contributor
Star Contributor
All looks  okay … can you zip up those files with a unit test that displays the problem?

udoderk
Champ in-the-making
Champ in-the-making
Hi,

I have a problem using external forms. I've just started learning Activiti, so I may misunderstand something. Anyway…

I've created some test project, based on VacationRequest sample. When I try to add external form to user task using activiti:formKey="request.form" (it is in the same package) nothing happens. It renders only empty form with only button Complete task. Where might be the mistake?

Thanks in advance for any help!
First, thank you for your example.
I had same problem,  when I used the xml example from Activiti Explorer without changing the IDs into xml. After I changed the IDs, everything works correctly.