Hakan Ardo > DBIx-HTMLView-LATEST > DBIx::HTMLView::N2One



Annotate this POD

View/Report Bugs


  DBIx::HTMLView::N2One - A many to one relation between two tabels


  print $fld->view_html;


This is a subcalss of DBIx::HTMLView::Int used to represent a relation to a post in another (or possibly the same) table. The relation will be represented in the database by a field containing the id of the post related to. Se the DBIx::HTMLView::Field and DBIx::HTMLView:.Fld (the superclass of Field) manpage for info on the methods of this class.

NOTE: Even if this is a relation it is NOT a subclass of DBIx::HTMLView::Relation.

#FIXME: List possible params


Returns the name of the to table.


Returns the DBIx::HTMLView::Table object representing the to table.

$fld->view_fmt_edit_html($postfmt_name, $postfmt)

Used by the default edit_html fmt. It will return a string containing "<input type=radio ...>" constructs to allow the user to specify which post we should be related to. All posts in the to table will be listed here and viewed with view_fmt($postfmt_name,$postfmt).

$postfmt_name will default to 'view_html'. If $postfmt isn't defined some decent default is tried to be derived from the default fmt for $postfmt_name.

The $postfmt should contain a <Var Edit> tag that will be replaced by the radio button.

$fld->view_fmt($fmt_name, $fmt)

Will call view_fmt($fmt_name, $fmt) on the post this relation is pointing to and return the result, se DBIx::HTMLView::Post for info on the $fmt format.

If $fmt is not defined the fmt parameter named $fmt_name specified in the $data parameter to the constructor will be used as fmt string.

If the fmt string starts with "<InRel>", the rest of the fmt will be handled by this method instead of calling the PostSet version. Current the only supported construct here is <perl>...</perl> which will be replaced by the returnvalue of eval(...).

syntax highlighting: