I have an orm\model to represent messages in a contact form. I have an email confirmation field in my model, and ofc don't want to write it in the table related. But I can't found how to do that in docs or on this forum. Sorry if the question is so nooby.
(I managed to did it just by changing a bit the orm\Model save() method, but I want to know if there is a native mechanism to do this).
I put that email_conf field in the $_properties of my model since I want it to display on the form.
But, from your answer, obviously that isnt the proper way to handle that... should I add the email_conf from field outside the $_properties of the model?
I assume you use a fieldset, and use add_model() to generate the fieldset?
If that is so, you can add a method to your model called set_form_fields(). It is called by add_model(), It's prototype is:
void public static function set_form_fields($fieldset, $instance = null) {}
it gets passed the fieldset object you are creating, and optionally a model instance in case you call add_model() with an instance instead of a model name.
in your method, call
parent::set_form_fields($fieldset, $instance)
first, to create the fieldset from the model. After that, you can modify the fieldset. You can also use this to populate the fieldset with for example dropdown values (option arrays), custom labels, etc.