Ferreteria/v2/usage/forms/displaying: Difference between revisions

From Woozle Writes Code
< Ferreteria‎ | v2‎ | usage‎ | forms
Jump to navigation Jump to search
(extracted from parent page)
 
(clarifying comments)
Line 3: Line 3:


It can also be done without templates by retrieving the control and asking it to render itself:<php>
It can also be done without templates by retrieving the control and asking it to render itself:<php>
    $oForm = $this->EditForm();
    $oForm = $this->EditForm();   // retrieve the form object (build it if needed)
    $oForm->LoadRecord();
    $oForm->LoadRecord();         // copy values from {memory image of record} to {form fields}
    $ftTag = $oForm->ControlObject('Name')->Render($doEdit);
    $ftTag = $oForm->ControlObject('Name')->Render($doEdit);
    $ftCust = $oForm->ControlObject('ID_Cust')->Render($doEdit);
    $ftCust = $oForm->ControlObject('ID_Cust')->Render($doEdit);

Revision as of 01:12, 3 November 2015

displaying a form

See Template:Vbzcart/code (inside function AdminPage_basic()) for a working example of a full-page form.

It can also be done without templates by retrieving the control and asking it to render itself:<php> $oForm = $this->EditForm(); // retrieve the form object (build it if needed) $oForm->LoadRecord(); // copy values from {memory image of record} to {form fields} $ftTag = $oForm->ControlObject('Name')->Render($doEdit); $ftCust = $oForm->ControlObject('ID_Cust')->Render($doEdit); $ftAddr = $oForm->ControlObject('ID_Addr')->Render($doEdit); $ftName = $oForm->ControlObject('ID_Name')->Render($doEdit); </php> ...(and so on), then manually plugging the rendered controls into the desired output format:<php> $out .= <<<__END__

...

ID:$id
Tag:$ftTag
Status:$ftStatus
Customer:$ftCust
Address:$ftAddr
Name:$ftName

__END__; </php>