[jifty-devel] Rendering form_fields ?

mraptor mraptor at gmail.com
Sat Mar 3 12:31:38 EST 2007


I played alot ;( still cant do it right...the label is still overlapped
by the inputs and selects..

I have also just tried to modify the ::Fields::render, so that I can
make it like table cells, like this :


sub render_as_table_cells { 
    my $self = shift; 
    Jifty->web->out('<td class="label_cell">'); 
    $self->render_wrapper_start(); 
    $self->render_preamble(); 
 
 
    $self->render_label(); 
    Jifty->web->out('</td><td class="widget_cell">'); 
    if ($self->render_mode eq 'update') {  
        $self->render_widget(); 
        $self->render_autocomplete_div(); 
        $self->render_inline_javascript(); 
        $self->render_hints(); 
        $self->render_errors(); 
        $self->render_warnings(); 
        $self->render_canonicalization_notes(); 
    } elsif ($self->render_mode eq 'read'){  
        $self->render_value(); 
    } 
    $self->render_wrapper_end(); 
    Jifty->web->out('</td>'); 
    return (''); 
}

But for some reason I can not figure out yet... I still get the
error.png image rendered even if I don't have error ?! Just found it in
notices.css !!!

I was looking on something else too. In Field.pm everything is rendered
with Jifty->web->out(), wouldn't it be better if all these methods just 
return strings, which are then concatenated and ->out() in the
render()-method.
I know there is alot of them, but this way anyone can have its own way
to display or handle the errors,warnings etc..
The way now these things are rendered may be good for simpler designs
but from designers point of view it is not always possible to display
the errors,hints,etc like they are done now it just makes the form and
the whole page looks ugly.

One more thing my own error in the begining was (because I didn't and
still can't figure all css-styles and their interaction to get the
final result) that I was doing :

<td>$a->form_field('name')->render_label</td>
<td>$a->form_field('name')->render_widget</td>

in the mason-template and because of this I could not see the
mandatory-error,
I thought it should appear by Jifty->web->render_errors, but it didnt.
So just because of this I was thinking to write my own handling of
mandatory fields !!! (which is not DRY ;) ) 


> 
> On Mar 3, 2007, at 1:17 AM, mraptor wrote:
> 
> > I'm using
> > $action->form_field('name');
> >
> > The problem is that if the when I have label which is more than one
> > word f.e. "This is a label" it goes split over several rows and
> > overlaps with the input fields and so on..
> >
> 
> I suspect that what you want to do is play with the CSS for labels.
> 
> Best,
> Jesse
> 
> > I tried also to do :
> >
> >
> > <td>$action->form_field('name')->render_label</td>
> > <td>$action->form_field('name')->render_widget</td>
> >
> > but then I loose all other things the render() method does !!
> > any ideas ?
> >


-- 
Gee I don't have signature


More information about the jifty-devel mailing list