[html-formfu] Beware of char cases

Daisuke Maki daisuke at endeworks.jp
Mon Oct 22 06:08:56 GMT 2007


Hi,

Just ran into a problem where upgrading from FormFu pre-1.00001 to
1.00005 resulted in previously working form would not render properly.
Specifically, the fieldsets were placed in the totally wrong place e.g.
forms that were previously rendering as

 <form>
   <fieldset>
     <span>
       <input>
     </span>
   </fieldset>
   <fieldset>
     <span>
       <input>
     </span>
   </fieldset>
 </form>

Now rendered as

 <form>
   <fieldset>
     <span>
       <input>
     </span>
     <fieldset>
     <span>
       <input>
     </span>
   </fieldset>
 </form>

The root cause seems to be the renaming that happened for CPAN release.
Namely, what used to be fieldset.pm now became Fieldset.pm -- and
probably a simple search/replace caused the following code to fail:

  sub _single_element {
     ....
     if (   $self->can('auto_fieldset')
        && $self->auto_fieldset
        && $new->type ne 'Fieldset' )
     {

     }
  }

$new->type contained 'fieldset', not 'Fieldset'.

I suspect that there might be other places that something similar is
happening, but for now I just committed r489 which fixes this by using a
regular expression.

let me know if this works out or not.

--d








More information about the HTML-FormFu mailing list