LIBPHP: HTML Template and OOH FORMS problem
| From: | Joel Holder | Date: | Fri, 27 Jun 2003 18:07:25 +0000 |
| Subject: | LIBPHP: HTML Template and OOH FORMS problem | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-6300@lists.php.net to get a copy of this message | ||
I know this list is for pear, but the likely hood of PEAR users being well
versed in LIBPHP is high. So here goes..
I am using the OOH FORMS (oohforms.inc) and HTML Template classes to create
dynamic form objects inside html templates. All works well except...
My forms are loosing their "name" attribute when passed through the the html
templates. This breaks the submit functionality of normal submit buttons as
well as any javascript that references the form object. Take for example.
This code:
<!--------- Sample Recipe !---------->
//CREATE OOH FORMS OBJECT
$f = new form('this'); // create a form object
//ADD A SUBMIT BUTTON
$f->add_element(array("type"=>"submit",
"name"=>"submit_button")); // uses a standard
submit - this functionality is disabled when pushed into html template
//ADD ANOTHER BUTTON WITH A JAVA EVENT
$f->add_element(array("type"=>"button",
"name"=>"random_button",
"value"=>"Blah",
"extrahtml"=>" OnClick=\"JavaScript:
this.form.submit();\"")); //
uses a java submit action - this functionality is also disabled when pushed
into html template
//START FORM DEFINITION AND SPOOL FORMS ONTO A PHP STRING VAR
$spool .= $f->start('MyJavachecker', $method,$action, $target,'this');
$submit .= $f->get_element('submit_button', 'submit this biotch');
$submit .= $f->get_element('random_button', 'blah');
$spool .= $f->finish();
//HERE IS WHERE I SEND IT TO THE HTML TEMPLATE
// (just assume that the html template object $t was created earlier and
contains a reference to {TOP}
$t->set_var(array("TOP" => $spool));
<!--------- Sample Recipe !---------->
The net result is that the form shows up in the templates output, but none
of the javascript works, including the built in OOH FORMS client side field
validation, and the standard html submit functionality is lost as well.
This is happening because the form object's name ('this') is being lost as
the classes chew this stuff up and spit it out. I hope there are some L33t
PHP programmers out there that can tell how to surmount this problem.. Any
help at all is greatly greatly appreciated. Thanks in advance for "show tha
love"!
Joel