Input validation for Custom Fields

Hello Gibbon Community,

I’m looking for a way to perform input validation on Custom Fields. More specifically, I am trying to ensure that the value within a custom field I created (A simple numeric value if that is relevant) is entirely unique within the database.

As far as I could tell, there is no option to define uniqueness upon creation of a custom field, and due to Custom fields being saved as aggregated JSON values in the “fields” column, I am unsure how to approach this problem.

I’m entirely fine with a hacky solution at this stage, although I think the ability to define custom fields as unique on creation would be a helpful feature for Gibbon in general :slight_smile:

Kind regards!

Hi @JadenD
Thank you for the question. I do agree the ability to feature to define Custom Fields as unique on creation would be a great improvement.
For now, one working solution could be to use custom scripting at the save logic level to query and validate the uniqueness of the custom field’s numeric value before allowing the save, maybe by implementing a server-side validation. You can add a custom script, that upon form submission, parses the JSON field values and queries the database to check if the numeric value in the custom field already exists in any other record. If found, it returns an error preventing saving, thereby enforcing uniqueness. Let me know if you could find any other solution. Thanks.