File tree Expand file tree Collapse file tree 4 files changed +23
-7
lines changed Expand file tree Collapse file tree 4 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 133
133
$ ( 'body' ) . on ( 'click' , '.manyfield__save' , function ( e ) {
134
134
var form = $ ( this ) . parents ( '.modal-content' ) . find ( 'form' ) ;
135
135
136
- if ( form . checkValidity ( ) ) {
136
+ if ( form . get ( 0 ) . checkValidity ( ) ) {
137
137
var body = $ ( this ) . parents ( '.modal-content' ) . find ( '.modal-body' )
138
138
. addClass ( 'loading' )
139
139
144
144
} )
145
145
} else {
146
146
e . preventDefault ( ) ;
147
+
148
+ return false ;
147
149
}
148
150
} )
149
151
157
159
// find the add modal, set the content to that and open it.
158
160
var id = parents . attr ( 'id' ) ;
159
161
var modal = $ ( '#' + id + '_modal' ) ;
162
+ var saveURL = modal . attr ( 'data-save-url' ) ;
160
163
161
164
$ . get ( modal . data ( 'form-url' ) , { RecordID : recordId } , function ( data ) {
162
- modal . find ( '.modal-body' ) . html ( data ) . removeClass ( 'loading' ) ;
165
+ modal . find ( '.modal-body' ) . html ( $ ( '<form action="' + saveURL + '"></form>' ) . html ( data ) ) . removeClass ( 'loading' ) ;
163
166
modal . modal ( 'show' ) ;
164
167
} ) ;
165
168
} )
Original file line number Diff line number Diff line change @@ -468,7 +468,7 @@ public function AddLink()
468
468
}
469
469
470
470
/**
471
- * Add URL
471
+ * Edit Record Form URL
472
472
*
473
473
* @return string
474
474
*/
@@ -480,6 +480,19 @@ public function EditLink()
480
480
);
481
481
}
482
482
483
+ /**
484
+ * Save Record Form URL
485
+ *
486
+ * @return string
487
+ */
488
+ public function SaveLink ()
489
+ {
490
+ return Controller::join_links (
491
+ $ this ->AbsoluteLink ('saveRecord ' ),
492
+ '?SecurityID= ' . SecurityToken::inst ()->getValue () . '&ClassName= ' . $ this ->value ->dataClass ()
493
+ );
494
+ }
495
+
483
496
/**
484
497
* Override set value.
485
498
*/
Original file line number Diff line number Diff line change 21
21
</div>
22
22
<% end_if %>
23
23
24
- <div class=" modal" id=" {$HolderID}_modal" data-form-url=" $EditLink" >
24
+ <div class=" modal" id=" {$HolderID}_modal" data-form-url=" $EditLink" data-save-url= " $SaveLink " >
25
25
<div class=" modal-dialog modal-lg" role=" document" >
26
26
<div class=" modal-content" >
27
27
<div class=" modal-header" >
35
35
</div>
36
36
37
37
<div class=" modal-footer" >
38
- <button type=" button" class=" btn btn-primary manyfield__save" data-dismiss= " modal " >Save</button>
38
+ <button type=" button" class=" btn btn-primary manyfield__save" >Save</button>
39
39
<button type=" button" class=" btn btn-secondary" data-dismiss=" modal" >Close</button>
40
40
</div>
41
41
</div><!-- /.modal-content -->
Original file line number Diff line number Diff line change 21
21
</div>
22
22
<% end_if %>
23
23
24
- <div class=" modal" id=" {$HolderID}_modal" data-form-url=" $EditLink" >
24
+ <div class=" modal" id=" {$HolderID}_modal" data-form-url=" $EditLink" data-save-url= " $SaveLink " >
25
25
<div class=" modal-dialog modal-lg" role=" document" >
26
26
<div class=" modal-content" >
27
27
<div class=" modal-header" >
35
35
</div>
36
36
37
37
<div class=" modal-footer" >
38
- <button type=" button" class=" btn btn-primary manyfield__save" data-dismiss= " modal " >Save</button>
38
+ <button type=" button" class=" btn btn-primary manyfield__save" >Save</button>
39
39
<button type=" button" class=" btn btn-secondary" data-dismiss=" modal" >Close</button>
40
40
</div>
41
41
</div><!-- /.modal-content -->
You can’t perform that action at this time.
0 commit comments