Another one:

 I need an input type that looks just like the link view of an object
on the view page.  Basically an href with a hidden input and the
stringified object as the content:

<a href="localhost/beerdb/beer/view/3">
    <input type=hidden name=beer_id value=3/>
    Murphy's Irish Stout
</a>

 I'm calling this  _to_link_hidden  in my AsForm for now.  Here is the
 prelim hack.

=head2 _to_link_hidden($r,[ $obj ])

Makes a link with a hidden input with the id of $obj as the value and name
the objects primary key.
If called without $obj  then it treats self as the object.

=cut
sub _to_link_hidden {
    my ($self, $r, $obj) = @_;
    $self->_croak("_to_link_hidden called without Maypole Request object (\$r)")
        unless $r;
    $obj ||= $self;
    $self->_croak("_to_link_hidden has no object") unless ref $obj;

    my $href = $r->config->{uri_base} . "/". $obj->table."/view/".$obj->id;
    my $a = HTML::Element->new('a', 'href' => $href);
    $a->push_content("$obj");
    $a->push_content($obj->_to_hidden);
    $a;
}


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Maypole-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-devel

Reply via email to