06-22-2017 12:40 PM
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.
07-07-2017 10:39 AM
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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.