> > Hello all!
>
> Hi.
>
> > If field in SQL table is null and it is present in hashref then
input
> > field doesn't appear and even manager can't modify it.
>
> Okay, okay. You're trying to do too much in the template.
There's two
> things you need to pass to the template
>
> a) Tell it if the user has access to that username (so it knows to
> display that form)
> b) The default username (even if it is empty)
>
> The template should be dumb - it shouldn't have to determine a) from
b).
> Do the application logic in your perl code.
I know these rules well. Template logic is as dumb as possible. If a
field is present in hash (even if it has a value undef) -> show input
field, if it is absent -> doesn't show field. Not ??
I even think about 'keys' method for determining, but it is too
complex for such simple problem.
> How about doing something like
>
> __perl__
> $return_to_template->{first_field_allow} = !$deny{first_field};
It is just another variable. I think it is needless to pass second
variable for displaying that first variable has a value - undef. We
can remove method 'defined' and use such techique for determining
value 0, for example :)
I think that Larry Wall implements 'exists' function not without
reason...
>
> __Template__
> [% FOREACH row = rows %]
> [% IF first_field_allow %]
> <input type="text" name="first_field" value="[% row.first_field
%]">
> [% END %]
> [% END %]
>
> Later.
>
> Mark.
>
> --
> Mark Fowler
> Technology Developer
> http://www.indicosoftware.com/
>
>
>
>