Liu, Aaron | 16 Mar 04:21

Re: Suggestion for indivdual field scripting/styling

Here is the diff, I hope this will not break anything (I just inlined
the call to tr() and added parameter to it.)

===================================================================
--- FormBuilder_orig.pm Mon Mar 14 19:32:14 2005
+++ FormBuilder.pm      Wed Mar 16 03:16:58 2005
@@ -1120,7 +1120,6 @@

         # Get table stuff and reused calls
         my $table = $self->table;
-        my $tr    = $self->tr;
         my $td    = $self->td;
         $html .= $table . "\n";     # want newline regardless

@@ -1132,7 +1131,7 @@
         for my $field (@unhidden) {
             debug 2, "render: attacking normal field '$field'";
             if ($table) {
-                $html .= $tr . $td . $font;
+                $html .= $self->tr({id=>"tr_$field"}) . $td . $font; #
generate id for table row
                 if ($field->invalid) {
                     $html .= $self->{messages}->form_invalid_opentag;
                 } elsif ($field->required) {
===================================================================

> -----Original Message-----
> From: Nathan Wiger [mailto:nate <at> sun.com] 
> Sent: Wednesday, March 16, 2005 02:35
> To: Liu, Aaron
> Cc: fbusers <at> formbuilder.org
> Subject: Re: Suggestion for indivdual field 
> 
> This sounds reasonable, send me a diff -u patch against 3.02 
> and I will 
> add it. In render(), you'll likely have to change the 
> $self->tr calls to 
> instead retrieve the %attr and then change it. Check out the 
> $self->td 
> calls.
> 
> -Nate
> 
> 
> Liu, Aaron wrote:
> > Hi,
> >  
> >     Despite Nathan's repeated advices on not to use the 
> > built-in rendering when one needs flexibility in various 
> parts of the 
> > document, I have found the built-in rendering quite 
> sufficient for my 
> > usage, with one exception: I need to be able to address individual 
> > fields's containing row (<tr>) by id. With individual id 
> assigned to the 
> > table rows I can easily show and hide fields by javascript 
> at run-time. 
> > I can also highlight fields I need by applying style to individual 
> > fields I needed. So far I have hacked the code (for version 2) to 
> > include ths id so an input field named "password" would be enclosed 
> > within a <tr id="tr_password" ... >. Do you think this 
> feature can be 
> > included in version 3 or am I just too lazy and should switch to 
> > templates instead? (Or it was already in version 3 and I 
> missed it?) Any 
> > comments are welcome.
> >  
> > Aaron
> >  
> 
> 
> 


Gmane