Open <div> tag not getting closed - invalid & problematic markup

tizzo - April 9, 2009 - 16:03
Project:Flexifield
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm using flexifield with a Zen subtheme and a flexifield form with unlimited entries is adding an opening div and failing to close it. This is breaking my whole page and causing the header/sidebars to appear below the form. I fixed it using hook_form_alter() and adding a after the description for the field.

I have verified that they problem is being created by flexifield but don't have the time to track it any further as I'm sort of under a deadline.

#1

tizzo - April 9, 2009 - 16:05

Durp, of course I didn't escape that. It should have read "adding closing div tag after the description for the field".

#2

evolvingweb - April 10, 2009 - 22:31

Here's how I patched it so it works for me. I'm not familiar with #ahah, and the code in flexifield-widget.inc is too dense for me to grok easily.

Index: flexifield/flexifield-widget.inc
===================================================================
--- flexifield/flexifield-widget.inc    (revision 2800)
+++ flexifield/flexifield-widget.inc    (working copy)
@@ -85,6 +85,7 @@
   $sKeyAddMore = $aElement['#field_name'] . '_add_more';
   if ($aElement[$sKeyAddMore]) {
     $aElement['#prefix'] = '<div class="clear-block" id="'. $sId .'-add-more-wrapper"><div id="'. $sId .'-items">';
+    $aElement['#suffix'] = '</div></div><!--fixme-->'; //FIXME: This is a hack to deal with unclosed divs in the prefix
     $aElement[$sKeyAddMore]['#ahah']['wrapper'] = $sId . '-items';
     $aPathParts = explode('/', $aElement[$sKeyAddMore]['#ahah']['path']);
     $aElement[$sKeyAddMore]['#ahah']['path'] = 'flexifield/ahah/addmore/' . implode('/', array_slice($aPathParts, 2, 2)) . '/' . implode(':', $aElement['#parents']);

#3

evolvingweb - April 10, 2009 - 22:31
Status:active» needs review

#4

effulgentsia - April 27, 2009 - 04:00
Version:6.x-1.0-alpha2» 6.x-1.x-dev
Status:needs review» fixed

This is now fixed in the dev snapshot. Rather than the patch by evolvingweb, I changed the line above it to only make one opening div. The 2 opening divs was how it was done with CCK 2.1, but 1 opening div is how CCK 2.2 does it. So, the flexifield code currently in dev which will become part of all future releases starting with alpha3, requires CCK 2.2 or later.

#5

System Message - May 11, 2009 - 04:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.