Commit 25aa5a16 authored by KR Moorhouse's avatar KR Moorhouse Committed by GitHub

Merge pull request #3075 from wpninjas/issue#3069

Move forced required validation for submission.
parents e644ebd7 3b6192ec
......@@ -46,8 +46,14 @@ define([], function() {
var validate = nfRadio.channel( 'forms' ).request( 'maybe:validate', formModel );
if( false !== validate ){
// When validating all fields, set clean to false to force validation.
_.each( formModel.get( 'fields' ).models, function( fieldModel ) {
fieldModel.set( 'clean', false );
} );
/*
* This method is defined in our models/fieldCollection.js file.
* This method is defined in our models/fieldCollection.js file,
* except where overridden by an add-on (ie Layout & Styles).
*/
formModel.get( 'formContentData' ).validateFields();
}
......
......@@ -49,6 +49,7 @@ define([], function() {
},
validateModelData: function( model ) {
if ( 1 != model.get( 'required' ) || ! model.get( 'visible' ) || model.get( 'clean' ) ) {
return false;
}
......
......@@ -12,8 +12,6 @@ define( ['models/fieldModel'], function( fieldModel ) {
validateFields: function() {
_.each( this.models, function( fieldModel ) {
// When validating all fields, set clean to false to force validation.
fieldModel.set( 'clean', false );
nfRadio.channel( 'submit' ).trigger( 'validate:field', fieldModel );
}, this );
},
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment