HashanChamara / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
0 stars 0 forks source link

Need to divide the output of the form elements and data output for header (such as connecting css and js files). #151

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
want to divide the output of the form elements and data output for header (such 
as connecting css and js files).
For example it can be concluded as follows:

<?php
//PFBC 2.x PHP 5 >= 5.3
session_start();
include($_SERVER["DOCUMENT_ROOT"] . "/PFBC/Form.php");
$form = new PFBC\Form("GettingStarted", 300);
$form->addElement(new PFBC\Element\Textbox("My Textbox:", "MyTextbox"));
$form->addElement(new PFBC\Element\Select("My Select:", "MySelect", array(
   "Option #1",
   "Option #2",
   "Option #3"
)));
$form->addElement(new PFBC\Element\Button);
$form->render();

//PFBC 2.x PHP 5
session_start();
include($_SERVER["DOCUMENT_ROOT"] . "/PFBC/Form.php");
$form = new Form("GettingStarted", 300);
$form->addElement(new Element_Textbox("My Textbox:", "MyTextbox"));
$form->addElement(new Element_Select("My Select:", "MySelect", array(
   "Option #1",
   "Option #2",
   "Option #3"
)));
$form->addElement(new Element_Button);
$form->render('css');// output css
$form->render('js');// output js

... some code here...

$form->render('form', 'GettingStarted');// output form GettingStarted
?>

If this is possible without changing the code, I do not find in the 
documentation. Tell me, is it possible?

Original issue reported on code.google.com by mirivlad on 17 Aug 2011 at 11:58

GoogleCodeExporter commented 8 years ago
No, it's not currently possible without modifying code.  That being said, if 
you look in PFBC/Form.php, you should find that there are methods (renderCSS 
and render JS) that would make this type of implementation fairly 
straightforward.

- Andrew

Original comment by ajporterfield@gmail.com on 25 Aug 2011 at 2:44