Forms being rendered incorrectly

reubidium - May 3, 2009 - 22:47
Project:Panels Form Elements
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hello,

Having trouble getting this to work. Was trying to get a user_register form in a panel. Had no problem getting context set and adding the fields, however submissions were doing nothing. I was able to detect that panels_fe was invoking theme_form but not passing a correct structure, resulting in a form element within a form element. The outermost form element has no ID or Action (since these parameters were not in the $element arg to theme_form).

I created a modified theme_form, but this is hacky and if this is absolutely necessary it needs to be documented in the read me.

<?php
function phptemplate_form($element) {
 
// Anonymous div to satisfy XHTML compliance.
 
$action = $element['#action'] ? 'action="' . check_url($element['#action']) . '" ' : '';

  if (
$element['#id']) {
    return
'<form '. $action .' accept-charset="UTF-8" method="'. $element['#method'] .'" '. 'id="'. $element['#id'] .'"'. drupal_attributes($element['#attributes']) .">\n<div>". $element['#children'] ."\n</div></form>\n";
  }
  else {
    return
$element['#children'];
  }
}
?>

 
 

Drupal is a registered trademark of Dries Buytaert.