# How to update the save function in a RecordEditForm

**URL:** <https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134>\
**Category:** Module Development\
**Created:** [February 14, 2022, 9:08pm UTC](https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134 "2022-02-14T21:08:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jean-Luc\_Stiles](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jean-Luc\_Stiles](https://forum.inductiveautomation.com/u/Jean-Luc_Stiles)\
**Post date:** [February 14, 2022, 9:08pm UTC](https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134/1 "2022-02-14T21:08:57Z")

</div>

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).

 ![Update example](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/1/212d70d4d319d93cf311fe40da339ba5f50098c9.png)

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](https://docs.inductiveautomation.com/display/SE/Storing+data+with+PersistentRecords) 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?

Thanks

---

<div class="post-metadata">

**Author:** ![Jean-Luc\_Stiles](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jean-Luc\_Stiles](https://forum.inductiveautomation.com/u/Jean-Luc_Stiles)\
**Post date:** [February 14, 2022, 9:48pm UTC](https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134/2 "2022-02-14T21:48:45Z")

</div>

I looked deeper into the javadoc and I think my answer lies somewhere in here:  
[http://files.inductiveautomation.com/sdk/javadoc/ignition79/794-beta1/com/inductiveautomation/ignition/gateway/web/components/AbstractRecordEditPanel.html#onRecordEdited-simpleorm.dataset.SRecordInstance-](http://files.inductiveautomation.com/sdk/javadoc/ignition79/794-beta1/com/inductiveautomation/ignition/gateway/web/components/AbstractRecordEditPanel.html#onRecordEdited-simpleorm.dataset.SRecordInstance-)

(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

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 14, 2022, 10:01pm UTC](https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134/3 "2022-02-14T22:01:54Z")

</div>

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):  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/b/4b7d26edec3c4de851d08fdd540b695ed798ff5f.png)

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

---

<div class="post-metadata">

**Author:** ![Jean-Luc\_Stiles](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jean-Luc\_Stiles](https://forum.inductiveautomation.com/u/Jean-Luc_Stiles)\
**Post date:** [February 14, 2022, 10:11pm UTC](https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134/4 "2022-02-14T22:11:27Z")

</div>

Amazing, thank you.

---

<div class="post-metadata">

**Author:** ![Jean-Luc\_Stiles](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jean-Luc\_Stiles](https://forum.inductiveautomation.com/u/Jean-Luc_Stiles)\
**Post date:** [February 14, 2022, 10:21pm UTC](https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134/5 "2022-02-14T22:21:59Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 14, 2022, 10:28pm UTC](https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134/6 "2022-02-14T22:28:40Z")

</div>

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(...)`

---

<div class="post-metadata">

**Author:** ![Jean-Luc\_Stiles](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jean-Luc\_Stiles](https://forum.inductiveautomation.com/u/Jean-Luc_Stiles)\
**Post date:** [February 14, 2022, 10:31pm UTC](https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134/7 "2022-02-14T22:31:40Z")

</div>

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

Thanks

---

<div class="post-metadata">

**Author:** ![Jean-Luc\_Stiles](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jean-Luc\_Stiles](https://forum.inductiveautomation.com/u/Jean-Luc_Stiles)\
**Post date:** [February 15, 2022, 3:00pm UTC](https://forum.inductiveautomation.com/t/how-to-update-the-save-function-in-a-recordeditform/56134/8 "2022-02-15T15:00:26Z")

</div>

This worked, thank you.
