How to update the save function in a RecordEditForm

I want to set a minimum value for a configuration variable, in this case a refresh rate that cannot be set lower than 30 seconds.

Originally I tried limiting in the set function, but found that didn’t work. I then added a listener for my record that checks when the value updates that the new value isn’t below my minimum value.

While this works and doesn’t allow the value to be updated below my minimum, what I end up with on my configuration page isn’t as neat as I would like. When I hit save after entering a value that is below my threshold, it does overwrite it to the minimum value I have set, but the banner at the top displays my entered value below my threshold. (I have attached a picture to better display what I mean).

If I wanted to edit what the banner displays, what class should I be looking to overwrite? I know from Storing data with PersistentRecords - Ignition SDK Programmer's Guide - Ignition Documentation that somewhere there is probably an internal call performing a save function on my record that I need to Overwrite, I’m just unsure where that is.

Or do I need to make my own custom page using React?


I looked deeper into the javadoc and I think my answer lies somewhere in here:

(for any future people looing to do the same)

I also forgot to mention in my original post, that I am developing for 7.9.x

There’s a much, much easier option.

In your PersistentRecord extension, when you define the field you need a restriction on, call addValidator and provide a RangeValidator (in this case; there are other validators or you can create your own):

If the validation fails, the RecordEditForm will automatically render an appropriate message to the end user indicating the operation failed.

1 Like

Amazing, thank you.

I have tried adding that line into my persistent record, but my it isn’t compiling now.

public static final DoubleField RefreshRate = new DoubleField(META, “RefreshRate”, SFieldFlags.SMANDATORY, SFieldFlags.SDESCRIPTIVE).addValidator(new RangeValidator<>(30.0,1000.0)).setDefault(30);

My IDE (IntelliJ) is providing the following tip:
“reason: no instance(s) of type variable(s) Z exist so that RangeValidator conforms to SValidator”

What version of Ignition are you using? Looks like DoubleField didn’t get the addValidator overload until 8.1.2.

Instead, in a static block, you can try RefreshRate.getFormMeta().addValidator(...)

I am using 7.9.3 right now. I till give that a go.


This worked, thank you.