cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the valueof dropdown

akanksha
Champ in-the-making
Champ in-the-making

Using Activiti designer, how can I get the value I am selecting in the dropdown. If i write ${id of the field} in the documentation  i get the id of the option selected in the dropdown and not its value.

1 ACCEPTED ANSWER

gdharley
Elite Collaborator
Elite Collaborator

Ok, so the devil is always in the detail.

If you are using the sample activiti-explorer VAADIN application, the label of the dropdown is not saved to the process variable.

Obviously the easiest option would be to have the id and label match.

If that's not an option, then you can overload the org.activiti.engine.impl.form.DefaultFormHandler class.

Greg

View answer in original post

8 REPLIES 8

gdharley
Elite Collaborator
Elite Collaborator

Did you try the "name" attribute of the field? Likely this is what you are looking for.

Greg

akanksha
Champ in-the-making
Champ in-the-making

Hi Greg Harley,

Yes, I tried with "name" attribute but it is showing error "Error in parsing"

gdharley
Elite Collaborator
Elite Collaborator

Works for me, perhaps you can attach a test case.

akanksha
Champ in-the-making
Champ in-the-making

Can you please send me the screenshot of how you did it.

gdharley
Elite Collaborator
Elite Collaborator

Screenshot of form editor screen (notice I have attached to the form value changed event)

Here is the code to retrieve and alert the name and id for the selector:

var thisUn1 = scope.findFormFieldWithId(scope.allFormFields, 'selector').value;
alert("name :" + thisUn1.name + "id:" + thisUn1.id);

Regards,

Greg

akanksha
Champ in-the-making
Champ in-the-making

In this you have created your own form but I am using activiti explorer and using their form property only. I am not using any event. In activiti there is a form property type called enum, I want to display the value in the documentation box of next user task which I am selecting in the dropdown. If in documentation I write ${id of the enum field}, I get the id of the dropdown option selected and not its value.

gdharley
Elite Collaborator
Elite Collaborator

Ok, so the devil is always in the detail.

If you are using the sample activiti-explorer VAADIN application, the label of the dropdown is not saved to the process variable.

Obviously the easiest option would be to have the id and label match.

If that's not an option, then you can overload the org.activiti.engine.impl.form.DefaultFormHandler class.

Greg

akanksha
Champ in-the-making
Champ in-the-making

Ok.. thank you soo much.