|
Date: 6/8/2007 3:47 am · Subject: WebGUI::HTMLForm AUTOLOAD · Rating: -7
Lo, I was looking at doing something funky with an Wobject form and needed to tag the table row so that I could attach some Javascript to them. So I shuffled around the code and found WebGUI::Form::Control::toHtmlwithWrapper which constructs the table row. Within the definition of this object are a couple of handy little attributes, one in particular: rowClass. The comment didn't clear up my confusion about what this was but the code was quite clear: sub displayFormWithWrapper { my $self = shift; if ($self->passUiLevelCheck) { my ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext) = $self->prepareWrapper; return '<tr'.$rowClass.'> <td'.$labelClass.$hoverHelp.' valign="top" style="width: 25%;">'.$self->get("label").'</td> <td valign="top"'.$fieldClass.' style="width: 75%;">'.$self->displayForm().$subtext."</td> </tr>\n";
Grand, exactly what I need without having to change any core modules. So I change my Wobject to include rowClass where appropriate, restart and reload the page. No rowClass in the row. Huh? So I firkle around a bit more and bump into WebGUI::HTMLForm::AUTOLOAD which has the line: $params{rowClass} = $self->{_class};
before it calls the toHtmlwithWrapper. Could anyone explain to me why this line is here? _class can be set using WebGUI::HTMLForm::trClass. Would the line not be better presented as: $params{rowClass} ||= $self->{_class}; ? Cheers Kevin
|