I am trying to add a button to my form that executes a method of my class. I declare my method as an expression on the button, but it never runs, apparently I'm missing an event definition in the class that defines my button.
Here my code
public class ButtonFormType extends AbstractFormType implements Serializable {
private static final long serialVersionUID = 3256341958493366115L;
private static final String TYPE_NAME = "button";
@Override
public String getName() {
return TYPE_NAME;
}
@Override
public Object convertFormValueToModelValue(String propertyValue) {
return propertyValue;
}
@Override
public String convertModelValueToFormValue(Object modelValue) {
return modelValue == null ? null : modelValue.toString();
}
}
//BUTTON DEFINITION
public ButtonFormPropertyRenderer() {
super(ButtonFormType.class);
}
@Override
public Field getPropertyField(FormProperty formProperty) {
Button button = new Button();
button.setRequired(formProperty.isRequired());
button.setEnabled(formProperty.isWritable());
button.addStyleName(Reindeer.BUTTON_DEFAULT);
button.click();
return button;
}
//BUTTON IN FORM
<activiti:formProperty id="save" name="Save" type="button" expression="${myClass.save(execution, id, variable)}"></activiti:formProperty>
Regards.
Perhaps this thread is of help - Buttons to be used inside Alfresco Activiti Task Forms . If it's a custom action that you're looking to perform perhaps it's something you could do or invoke in javascript or process as part of a task or listener.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.