cancel
Showing results for 
Search instead for 
Did you mean: 

submitTaskFormData issue with Boolean Types

scolyer
Champ in-the-making
Champ in-the-making
I'm working on making a separate front end for activiti using Struts2 with the java api. I seem to be running into an issue when submitting forms.

Basically the flow is to render and display a form and then transform the parameters into an appropriate map and use submitTaskFormData or submitStartFormData to submit the form as needed.  This is working for the String cases that I've seen but seems to not work properly for other types (I'm focusing here on Booleans which have struck me with this issue).

For example, when trying to run the Vacation Request process that comes with activiti: on the Vacation Approval screen with the drop down. If I submit the form I get the following error:
org.activiti.engine.ActivitiException: condition expression returns non-Boolean: true (java.lang.String)

vacationApproved_type and vacationApproved are both getting passed into the submit methods. It's also interesting because on the initial request screen there is a boolean type (checkbox) that seems to work, and it is declared in a slightly different way:

broken: <input type="hidden" name="vacationApproved_type" value="Boolean" />

work: <input type="hidden" name="vacationPay_boolean" value="true"/>

The submit methods need Map<String, String> objects. One of my thoughts was to transform the booleans to their types as needed, but that appears to go against the intended design because the submit methods needs Strings rather than Objects.

The processes seem to work properly in Explorer but running my front end they seem to have an issue. I did note that in the Activiti documentation https://jira.codehaus.org/browse/ACT-294 that explorer does not seem to use these methods.

How should I proceed with these data types/ form submission?
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
You're mixing up the form-properties with the built-in form rendering. Form-properties have built-in type conversion to Strings

@see http://activiti.org/userguide/index.html#forms

scolyer
Champ in-the-making
Champ in-the-making
Unless I misunderstood what you were just saying, I think I must have mis-conveyed my original thought:

Using 5.4, when I use submitTaskFormData and the value I'm submitting is a string of true, boolean's are not properly receiving this as a true boolean. I assume that these are supposed to be casted from Strings to Booleans because the only that I can submit is Strings. However, this cast does not seem to be taking place. Any thoughts?

Thanks.

frederikherema1
Star Contributor
Star Contributor
Hi,

Default types of formProperties that are built in: Date, Enum, Long and String. So when you want to have "true" (as form-property value) converted to a Boolean variable, you'll have to add your own custom form-property type. Just search the forum for "customFormTypes" on how to do this.

frederikherema1
Star Contributor
Star Contributor
Never mind that Jira issue, I'm fixing this on trunk right now Smiley Wink
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.