Closed iwill closed 2 years ago
Hi,
The custom_workflow plugin is not able to change the color of field frames, but you can raise an error message, like this:
Use this code (change the custom_field ID and the validation):
unless custom_field_value(155) == "This is the right value"
errors.add(:base,"This is not the right value for #{CustomField.find(155).name.to_s} field!")
end
I hope it helps!
Yes, CustomField.find(155).name
helped me! The following code can highlight the custom field:
errors.add(CustomField.find(155).name, "#{CustomField.find(155).name.to_s} is invalid")
Thank you very much! @AirTibu
Hi, I have a custom field, and I'd like to validate its value in the Ruby script, but I need some helps:
How to highlight (error style with red border) the custom field when it's invalid?
How to get name of the custom field?
Thanks in advance!