@@ -41,42 +41,46 @@ define([
41
41
saveAttributeInNewSet : function ( ) {
42
42
43
43
var self = this ;
44
+ this . validate ( ) ;
45
+ if ( ! this . additionalInvalid && ! this . source . get ( 'params.invalid' ) ) {
46
+ prompt ( {
47
+ content : this . newSetPromptMessage ,
48
+ actions : {
44
49
45
- prompt ( {
46
- content : this . newSetPromptMessage ,
47
- actions : {
50
+ /**
51
+ * @param {String } val
52
+ * @this {actions}
53
+ */
54
+ confirm : function ( val ) {
55
+ var rules = [ 'required-entry' , 'validate-no-html-tags' ] ,
56
+ editForm = self ,
57
+ newAttributeSetName = val ,
58
+ i ,
59
+ params = { } ;
48
60
49
- /**
50
- * @param {String } val
51
- * @this {actions}
52
- */
53
- confirm : function ( val ) {
54
- var rules = [ 'required-entry' , 'validate-no-html-tags' ] ,
55
- editForm = self ,
56
- newAttributeSetName = val ,
57
- i ,
58
- params = { } ;
59
-
60
- if ( ! newAttributeSetName ) {
61
- return ;
62
- }
61
+ if ( ! newAttributeSetName ) {
62
+ return ;
63
+ }
63
64
64
- for ( i = 0 ; i < rules . length ; i ++ ) {
65
- if ( ! $ . validator . methods [ rules [ i ] ] ( newAttributeSetName ) ) {
66
- alert ( {
67
- content : $ . validator . messages [ rules [ i ] ]
68
- } ) ;
65
+ for ( i = 0 ; i < rules . length ; i ++ ) {
66
+ if ( ! $ . validator . methods [ rules [ i ] ] ( newAttributeSetName ) ) {
67
+ alert ( {
68
+ content : $ . validator . messages [ rules [ i ] ]
69
+ } ) ;
69
70
70
- return ;
71
+ return ;
72
+ }
71
73
}
72
- }
73
74
74
- params [ 'new_attribute_set_name' ] = newAttributeSetName ;
75
- editForm . setAdditionalData ( params ) ;
76
- editForm . save ( ) ;
75
+ params [ 'new_attribute_set_name' ] = newAttributeSetName ;
76
+ editForm . setAdditionalData ( params ) ;
77
+ editForm . save ( ) ;
78
+ }
77
79
}
78
- }
79
- } ) ;
80
+ } ) ;
81
+ } else {
82
+ this . focusInvalid ( ) ;
83
+ }
80
84
}
81
85
} ) ;
82
86
} ) ;
0 commit comments