Hi,

I'm looking for a way to set some content in a Block element, easy if
the content is static, but i'd like to be able to pass a code ref
instead that returns a text string, based on the type of user
currently logged in (some field in a DBIx::Class row) . e.g. <below>

Can this be done?

Ben


e.g.:

## Code
package Myapp::FormFu::Content;

sub return_string
{
    my $self = shift;
    my $c    = $self->form->stash->{context};

    if ($c->user->type eq 'A') {
        return 'Hello, user type A';
    }
    elsif ($c->user->type eq 'B') {
        return 'Hello, user type B';
    }
    else {
        return 'Unknown user';
    }
}

# Form config
{
    type => 'Block',
    content_xml => '+Myapp::FormFu::Content',
}

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to