Use validate function in presenter

Hi all,

I’m after a bit of advice please (maybe a rough code example too if I’m not asking too much). I have a presenter for a date field which has a setting for a minimum allowed year, how do I reference the value that has been added to the field settings e.g. 1901 (this could be blank so would need to handle a null) and the value that the person completing the form has entered? I’m hoping to then return something like return {valid: false, error: “Enter a valid year”}

Thank you in advance.

Adam.

Hi, you can use presenter.get_setting('setting_name') within the validate function, to get the value of custom settings.

Thank you Bob that is really helpful, my validate function seems to be working, I’ll pass it to some colleagues to test and then look to make live.