ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

data_form.js
Go to the documentation of this file.
1
6 if( !ultimix )
7 {
8 ultimix = {};
9 }
10
16 if( !ultimix.data_form )
17 {
18 ultimix.data_form = {};
19 }
20
30 ultimix.data_form.create_form = function( Action , Method )
31 {
32 if( !Method )
33 {
34 Method = 'post';
35 }
36
37 if( jQuery( '#data_form' ).length )
38 {
39 jQuery( '#data_form' ).remove();
40 }
41
42 jQuery( 'body' ).append( '<form id="data_form" method="' + Method + '" style="display: none;"></form>' );
43
44 if( Action )
45 {
46 jQuery( '#data_form' ).attr( 'action' , Action );
47 }
48 }
49
57 ultimix.data_form.append_data = function( Data )
58 {
59 for( i in Data )
60 {
61 jQuery( '#data_form' ).append( '<textarea name="' + i + '">' + Data[ i ] + '</textarea>' );
62 }
63 }
64
72 ultimix.data_form.move_form_data = function( SourceFormSelector )
73 {
74 var Data = ultimix.forms.extract_form_data( SourceFormSelector );
75
76 ultimix.data_form.append_data( Data );
77 }
78
88 ultimix.data_form.success_function = function( SourceFormSelector , Waiting )
89 {
90 return(
91 function( Result )
92 {
93 if( Result == ultimix.std_dialogs.MB_YES )
94 {
95 ultimix.data_form.move_form_data( SourceFormSelector );
96
97 document.getElementById( 'data_form' ).submit();
98
99 if( Waiting )
100 {
101 ultimix.std_dialogs.SimpleWaitingMessageBox();
102 }
103 }
104 }
105 );
106 }
107
123 ultimix.data_form.submit_dom_data = function( SourceFormSelector , ConfirmString , Action , Waiting , Method )
124 {
125 ultimix.data_form.create_form( Action , Method );
126
127 Success = ultimix.data_form.success_function( SourceFormSelector , Waiting );
128
129 if( ConfirmString )
130 {
131 ultimix.std_dialogs.QuestionMessageBox( ConfirmString , Success );
132 return;
133 }
134
135 Success( ultimix.std_dialogs.MB_YES );
136 }
137
145 ultimix.data_form.wait_for_submit = function( Waiting )
146 {
147 document.getElementById( 'data_form' ).submit();
148
149 if( Waiting )
150 {
151 ultimix.std_dialogs.WaitingMessageBox( 'wait_please' , 'Info' );
152 }
153 }
154
170 ultimix.data_form.submit_data = function( Data , ConfirmString , Action , Waiting , Method )
171 {
172 ultimix.data_form.create_form( Action , Method );
173
174 Success = function( Result )
175 {
176 if( Result == ultimix.std_dialogs.MB_YES )
177 {
178 ultimix.data_form.append_data( Data );
179 ultimix.data_form.wait_for_submit( Waiting );
180 }
181 }
182
183 if( ConfirmString )
184 {
185 ultimix.std_dialogs.QuestionMessageBox( ConfirmString , Success );
186 return;
187 }
188
189 Success( ultimix.std_dialogs.MB_YES );
190 }