Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -543,8 +543,8 @@ |
544 | 544 | // template. |
545 | 545 | if ( $old_template_name != $template_name ) { |
546 | 546 | if ( isset( $template_label ) ) { |
547 | | - $form_text .= "<fieldset>\n"; |
548 | | - $form_text .= "<legend>$template_label</legend>\n"; |
| 547 | + $multipleTemplateString .= "<fieldset>\n"; |
| 548 | + $multipleTemplateString .= "<legend>$template_label</legend>\n"; |
549 | 549 | } |
550 | 550 | // If $curPlaceholder is set, it means we want to insert a |
551 | 551 | // multiple template form's HTML into the main form's HTML. |
— | — | @@ -552,11 +552,11 @@ |
553 | 553 | if ($allow_multiple) { |
554 | 554 | $multipleTemplateString .= "\t" . '<div class="multipleTemplateWrapper">' . "\n"; |
555 | 555 | $multipleTemplateString .= "\t" . '<div class="multipleTemplateList">' . "\n"; |
556 | | - if ( $curPlaceholder == null ) { |
557 | | - $form_text .= $multipleTemplateString; |
558 | | - } |
559 | 556 | } |
560 | 557 | } |
| 558 | + if ( $curPlaceholder == null ) { |
| 559 | + $form_text .= $multipleTemplateString; |
| 560 | + } |
561 | 561 | $template_text .= "{{" . $template_name; |
562 | 562 | $all_fields = $tif->getAllFields(); |
563 | 563 | // remove template tag |
— | — | @@ -719,7 +719,7 @@ |
720 | 720 | // Remove this tag, reset some variables, and close off form HTML tag. |
721 | 721 | $section = substr_replace( $section, '', $brackets_loc, $brackets_end_loc + 3 - $brackets_loc ); |
722 | 722 | $template_name = null; |
723 | | - if ( isset( $template_label ) ) { |
| 723 | + if ( isset( $template_label ) && $curPlaceholder == null ) { |
724 | 724 | $form_text .= "</fieldset>\n"; |
725 | 725 | unset ( $template_label ); |
726 | 726 | } |
— | — | @@ -1424,6 +1424,10 @@ |
1425 | 1425 | // current placeholder tag, but also add another |
1426 | 1426 | // placeholder tag, to keep track of it. |
1427 | 1427 | $multipleTemplateString .= self::makePlaceholderInFormHTML( $curPlaceholder ); |
| 1428 | + if ( isset( $template_label ) ) { |
| 1429 | + $multipleTemplateString .= "</fieldset>\n"; |
| 1430 | + unset ( $template_label ); |
| 1431 | + } |
1428 | 1432 | $form_text = preg_replace( '/' . self::makePlaceholderInFormHTML( $curPlaceholder ) . '/', |
1429 | 1433 | $multipleTemplateString, $form_text ); |
1430 | 1434 | } |