Rovo (12) [Avatar] Offline
#1
Hi,

while playing and testing things with some basic examples, I noticed that there are no decimal datatypes available for formProperty so the following example will produce an error:

<startEvent id="startevent1" name="Start">
<extensionElements>
<activiti:formProperty id="price" name="Price" type="double" required="true"></activiti:formProperty>
</extensionElements>
</startEvent>

changing the type to float or decimal does not work either. I have found the following statement in the book (p106 (pdf 109)): "The default type is string, other supported types are long, Boolean, enum and date."

So what is considered best practice for defining a currency value as above? long and loose the decimal-part or convert the price to string and convert the string to float/double inside of a java class which might not work for scripts.

A further things that keeps me busy is, are there any labels in forms I can use to print some output to in cases of errors? My current approach is to use a formProperty and set it only to readable:

<activiti:formProperty id="addressValidationErrorProp" name="Error" expression="${execution.getVariable('validationError') != null and validationError != '' ? validationError : ''}" writable="false" />

but this isn't realy beautiful as the property-field is displayed (without content) in case of an empty validationError string which happens on the first call. The form is called again if the validation for the input failed or produced an error. I'd love to know how to output errors like in the case you defined a formProperty to a type long and inserting some decimal values instead of an integer/long-value.

Thanks in advance,
Roman
tijs.rademakers (494) [Avatar] Offline
#2
Re: No decimal datatypes for formProperties?
Hi,

Decimal form types are not supported, you're right.
However, it would be simple to add a new decimal form type.
For Activiti 5.9 I think the best solution would be to use a String form type.

Best regards,

Tijs