Re: inflating columns to objects

[prev] [thread] [next] [Date index for 2004/10/26]

From: Drew Taylor
Subject: Re: inflating columns to objects
Date: 17:40 on 26 Oct 2004
On Tue, 26 Oct 2004 17:41:56 +0100, Dave Howorth
<dhoworth@xxxxxxx.xxx.xx.xx> wrote:
> Drew Taylor wrote:
> > Would a <textarea> not suffice here? It does the wrapping for you
> > within the browser but will send it all back as a single string to the
> > server. Unfortunately I'm not familiar with asForm so I can't tell you
> > how to get a <textarea> versus an <input type="text">
> 
> Hi Drew,
> 
> My problem isn't whether it's a textarea or not. AsForm should make that
> decision. But in any case it's all living within the Maypole framework
> and I think providing an inflation method is what I should be doing. The
> problem is that the inflation class I wrote isn't working properly in
> conjunction with AsForm. I expect I've misunderstood what I have to do
> in writing such a class.

I'm a bit confused (I'm also not a current maypole user either so...).
But if the column is just text, and AsForm will decide what widget to
use, then why do you need to inflate it? Inflating is usually done
when you have an object you'd like to present in a special way (ie a
Date object should display in your chosen format). Are you saying you
want the text itself formatted into lines? If so, why not just let the
form widget handle it?

As for how to inflate something it's very simple:

MyClass->columns(Essential=>qw(...my_col...));
MyClass->has_a(my_col => MyInflator, inflate=>\&MyInflator::inflate);
# the subref can be located in any package - just use a fully
qualified function name

package MyInflator;

sub inflate {
  my $value = shift;
  # format it...
  return $formatted;
}

Drew
        -- 
        ----------------------------------------------------------------
 Drew Taylor                 *  Web development & consulting
 Email: drew@xxxxxxxxxx.xxx  *  Site implementation & hosting
 Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
 ----------------------------------------------------------------

(message missing)

inflating columns to objects
Dave Howorth 16:23 on 26 Oct 2004

Re: inflating columns to objects
Drew Taylor 16:30 on 26 Oct 2004

Re: inflating columns to objects
Dave Howorth 16:41 on 26 Oct 2004

Re: inflating columns to objects
Drew Taylor 17:40 on 26 Oct 2004

Re: inflating columns to objects
Dave Howorth 13:24 on 27 Oct 2004

Re: inflating columns to objects
Drew Taylor 14:13 on 27 Oct 2004

Re: inflating columns to objects
Dave Howorth 14:33 on 27 Oct 2004

Re: inflating columns to objects
Drew Taylor 14:37 on 27 Oct 2004

Re: inflating columns to objects
Dave Howorth 16:17 on 27 Oct 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52