Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -149,6 +149,7 @@ |
150 | 150 | global $sfgTabIndex; // used to represent the current tab index in the form |
151 | 151 | global $sfgFieldNum; // used for setting various HTML IDs |
152 | 152 | global $sfgJSValidationCalls; // array of Javascript calls to determine if page can be saved |
| 153 | + global $sfgAdderButtons, $sfgRemoverButtons; |
153 | 154 | |
154 | 155 | // initialize some variables |
155 | 156 | $sfgTabIndex = 1; |
— | — | @@ -232,7 +233,6 @@ |
233 | 234 | } |
234 | 235 | } |
235 | 236 | $javascript_text = ""; |
236 | | - $sfgJSValidationCalls = array(); |
237 | 237 | $fields_javascript_text = ""; |
238 | 238 | |
239 | 239 | // Remove <noinclude> sections and <includeonly> tags from form definition |
— | — | @@ -1136,14 +1136,17 @@ |
1137 | 1137 | // in the form, to differentiate the inputs the form starts out |
1138 | 1138 | // with from any inputs added by the Javascript |
1139 | 1139 | $section = str_replace( '[num]', "[{$instance_num}a]", $section ); |
| 1140 | + $wrapperID = "wrapper_$sfgFieldNum"; |
| 1141 | + $removerID = "remover_$sfgFieldNum"; |
1140 | 1142 | $remove_text = wfMsg( 'sf_formedit_remove' ); |
1141 | 1143 | $form_text .= <<<END |
1142 | | - <div id="wrapper_$sfgFieldNum" class="multipleTemplate"> |
| 1144 | + <div id="$wrapperID" class="multipleTemplate"> |
1143 | 1145 | $section |
1144 | | - <input type="button" onclick="removeInstance('wrapper_$sfgFieldNum');" value="$remove_text" tabindex="$sfgTabIndex" class="remove" /> |
| 1146 | + <input type="button" id="$removerID" value="$remove_text" tabindex="$sfgTabIndex" class="remove" /> |
1145 | 1147 | </div> |
1146 | 1148 | |
1147 | 1149 | END; |
| 1150 | + $sfgRemoverButtons[] = "$removerID,$wrapperID"; |
1148 | 1151 | // this will cause the section to be re-parsed on the next go |
1149 | 1152 | $section_num--; |
1150 | 1153 | } else { |
— | — | @@ -1157,11 +1160,13 @@ |
1158 | 1161 | |
1159 | 1162 | END; |
1160 | 1163 | $add_another = wfMsg( 'sf_formedit_addanother' ); |
| 1164 | + $adderID = "adder_$sfgFieldNum"; |
1161 | 1165 | $form_text .= <<<END |
1162 | 1166 | <p style="margin-left:10px;"> |
1163 | | - <p><input type="button" onclick="addInstance('starter_$query_template_name', 'main_$query_template_name', '$sfgFieldNum');" value="$add_another" tabindex="$sfgTabIndex" class="addAnother" /></p> |
| 1167 | + <p><input type="button" id="$adderID" value="$add_another" tabindex="$sfgTabIndex" class="addAnother" /></p> |
1164 | 1168 | |
1165 | 1169 | END; |
| 1170 | + $sfgAdderButtons[] = "$adderID,$query_template_name,$sfgFieldNum"; |
1166 | 1171 | } |
1167 | 1172 | } else { |
1168 | 1173 | $form_text .= $section; |
— | — | @@ -1255,9 +1260,6 @@ |
1256 | 1261 | END; |
1257 | 1262 | |
1258 | 1263 | // add Javascript code for form-wide use |
1259 | | - $javascript_text .= SFFormUtils::validationJavascript(); |
1260 | | - $javascript_text .= SFFormUtils::instancesJavascript(); |
1261 | | - $javascript_text .= SFFormUtils::autocompletionJavascript(); |
1262 | 1264 | if ( $free_text_was_included && $showFCKEditor > 0 ) { |
1263 | 1265 | $javascript_text .= SFFormUtils::mainFCKJavascript( $showFCKEditor ); |
1264 | 1266 | if ( $showFCKEditor & ( RTE_TOGGLE_LINK | RTE_POPUP ) ) { |
— | — | @@ -1285,7 +1287,7 @@ |
1286 | 1288 | $javascript_text = ''; |
1287 | 1289 | } |
1288 | 1290 | |
1289 | | - return array( $form_text, "/*<![CDATA[*/ $javascript_text /*]]>*/", |
| 1291 | + return array( $form_text, $javascript_text, |
1290 | 1292 | $data_text, $new_text, $generated_page_name ); |
1291 | 1293 | } |
1292 | 1294 | |