Reputation: 8730
I am wondering if you could set title of field in form data on server side.
Use case for this is that you have one field, and depend on some server logic you would set title of the field. Is it posible to set it on server somehow, to not sending string value to client and then set the title.
I was looking at method
formData.getMyField.setPropertyByClass(c, v);
but I don't know if this method could do this and which property I need to set.
Upvotes: 1
Views: 83
Reputation: 302
FormData classes can contain two types of data holder classes:
AbstractValueFieldData
) andAbstractPropertyData
).A form data property is generated if the associated form has a member variable whose setter and getter is annotated with @FormData
.
The method setPropertyByClass(...)
is intended to set the value of a form data property in a form data object.
The method cannot be used to set the label of a form.
The standard way to set the label of a field would be to load the form data from the server and to set the label afterwards, as in the following code snippet:
...
public class ModifyHandler extends AbstractFormHandler {
MyFormData formData = SERVICES.getService(IMyProcessService.class).load();
importFormData(formData);
getMyField.setLabel(formData.getMyProperty().getValue());
}
...
Upvotes: 1