77
88var MyFORM = MyFORM || { } ;
99MyFORM = ( function ( ) {
10- console . log ( 'form: 1.3 .0' ) ;
10+ console . log ( 'form: 1.5 .0' ) ;
1111var fields_with_data = [ ] , // array for false autosave
12+
1213 Form = function ( ) {
13-
1414 //this.url = null;
1515 this . title = "FormBuilder" ;
1616 //this.action = "";
1717 this . method = "post" ;
1818 this . language = "English" ;
1919 this . body = [ ] ;
20-
21-
2220 } ;
2321
2422 Form . prototype = {
@@ -49,6 +47,7 @@ var fields_with_data = [], // array for false autosave
4947 this . autosaveButton ( ) ;
5048 Form . prototype . time_out = 800 ;
5149 }
50+
5251 return MyFORM . controller ( this , new MyFORM . field . factory ( ) ) ;
5352
5453 } ,
@@ -147,6 +146,7 @@ var fields_with_data = [], // array for false autosave
147146
148147 } ,
149148
149+
150150 successSave : function ( ) {
151151
152152 var save_form = $ ( "#save-form" ) , clone = save_form . clone ( ) ;
@@ -209,6 +209,7 @@ var fields_with_data = [], // array for false autosave
209209 fields_with_data . push ( name ) ;
210210 return name ;
211211 } ,
212+
212213 post : function ( o ) {
213214 if ( this . c . autosave && o . hasOwnProperty ( 'name' ) ) {
214215 $ . post ( this . c . controller_url , { add : o } , function ( r ) {
@@ -289,19 +290,35 @@ var fields_with_data = [], // array for false autosave
289290 */
290291
291292 generate : function ( o ) {
293+ var result = false ;
292294 h . inheritAll ( this , o ) ;
295+ this . setValueInputOptions ( ) ;
296+ fields_with_data = h . getAllProperty ( 'name' , this . body ) ;
293297 if ( this . body . length !== 0 ) this . render ( 'off' )
294298
295- this . setValueInputOptions ( ) ;
296- fields_with_data = h . getAllProperty ( 'name' , this . body ) ;
297- console . log ( fields_with_data ) ;
298299
299300 } ,
301+
302+ modules : {
303+ init : function ( ) {
304+ } ,
305+
306+ } ,
307+
308+ executeModules : function ( ) {
309+ for ( var prop in this . modules ) {
310+ if ( this . modules . hasOwnProperty ( prop ) ) {
311+ this . modules [ prop ] ( ) ;
312+ console . log ( 'execute module ' + prop ) ;
313+
314+ }
315+ }
316+ } ,
300317
301-
302- /**
303- * Render form
304- */
318+ servicesAfter : function ( ) {
319+
320+ } ,
321+
305322 render : function ( ) {
306323 var form = this ;
307324
@@ -320,7 +337,8 @@ var fields_with_data = [], // array for false autosave
320337 } )
321338 }
322339 this . preventNotValidaData ( ) ;
323-
340+ this . executeModules ( ) ;
341+ this . servicesAfter ( ) ;
324342 } ,
325343 // default save button if title or url are empty
326344 preventNotValidaData : function ( ) {
0 commit comments