I want to add a validation to check if a field has been change..
I would like to ask how can I get the original value of the a field and compare it to the new value.
I want to add a validation to check if a field has been change..
I would like to ask how can I get the original value of the a field and compare it to the new value.
in a before_save logic hook:
function before_save ($bean,$event,$arguments){
$what_the_value_was = $bean->fetched_row['field_name']
$what_the_value_is_now = $bean->field_name
if($what_the_value_was != $what_the_value_is_now){
//the value has changed.
}
)
In the record view controller you can get a list of the changed fields with:
Object.keys(this.model.changedAttributes(this.model.getSynced()));
FrancescaS
Thank you soo much Francesca Shiekh you've helped me a lot.