validateRequiredFields function on model object

  • 1
  • Question
  • Updated 3 years ago
  • Answered
  • (Edited)
There is a function available on the skuid model object, called "validateRequiredFields", but I couldn't find any documentation on it. What does it do?
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hey Moshe -

The model version of validateRequiredFields will iterate all of its registered lists and call validateRequiredFields on each list.  In short, doing the same thing described near the bottom of this page (http://help.skuid.com/m/11720/l/205336-skuid-ui-list) but for each list, instead of just a single list.

The list version of validateRequiredFields will iterate fields that are rendered and if that field is required, will ensure that it has a value.  The return value of this function is a list of messages containing any errors.  If there are items in the array returned, you can call handleMessages on an editor (e.g. pagetitle, wizard step, etc.) to display them.

Hope this helps!
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,014 Points 20k badge 2x thumb
Documentation for Model.prototype.validateRequiredFields( ) has been added. In a nutshell, what Barry said is correct :)