Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.3

Request #7969 Documentation for using my own $form container
Submitted: 2006-06-23 10:50 UTC
From: bennythebee at gmail dot com Assigned: olivierg
Status: Closed Package: Structures_DataGrid_Renderer_HTMLSortForm (version 0.1.0)
PHP Version: 5.1.4 OS: Debian Sarge
Roadmaps: (Not assigned)    
Subscription  


 [2006-06-23 10:50 UTC] bennythebee at gmail dot com (Benny Labach)
Description: ------------ I need to be able to set the form action of the Sortform myself, so I would like to use my own Quickform $form object. It seems to be possible but I can not get it working. A quick example of this scenario would be a nice addition to the Sortform renderer. Thanks!

Comments

 [2006-06-23 11:33 UTC] olivierg at php dot net (Olivier Guilyardi)
We'll try to mention that when we update the docs. Meanwhile, you may try something like : $form = new HTML_QuickForm(); $datagrid->fill($form);
 [2006-06-23 11:46 UTC] bennythebee at gmail dot com
Hello Olivier, thank you. I tried to use the fill method: $form = new HTML_QuickForm("MySortForm","post","/form/target/"); $form->addElement('hidden', 'foo', 'bar'); $datagrid->fill($form); $datagrid->render(DATAGRID_RENDER_SORTFORM,array("sortFieldsNum" => 1)); Which has no effect on the resulting Sortform. The form action, method, and name are still filled with the Classes' default, also, the additional hidden element is not included. Probably my error, but I can not find any docs on how to do this right. Primarily, I need to change the action's URL value. Can you help, please? Thanks.
 [2006-06-23 11:49 UTC] olivierg at php dot net (Olivier Guilyardi)
Although it might work as I just wrote, it is safer to specify the type: $datagrid->fill($form, array(), DATAGRID_RENDER_SORTFORM); In future releases, that may be required, since we'll certainly need to recognize several sorts of forms.
 [2006-06-23 11:51 UTC] wiesemann (Mark Wiesemann)
The problem might also be this piece of code: $datagrid->fill($form); $datagrid->render(DATAGRID_RENDER_SORTFORM,array("sortFieldsNum" => 1)); The right thing to do here would be: $datagrid->fill($form); $form->display(); The render() call uses a new form object which uses the default values of the SortForm renderer. The logic behind fill() is: - instantiate your object (e.g. HTML_QuickForm()) - let SDG fill it ($dg->fill($form)) - use the output method of your object (e.g. $form->display())
 [2006-06-23 11:56 UTC] olivierg at php dot net (Olivier Guilyardi)
Mark is right Actually, Benny and I have posted at the same time... I was just adding information to my message posted at 2006-06-23 11:33 UTC. Sorry for the confusion
 [2006-06-23 12:11 UTC] bennythebee at gmail dot com
Hello guys, I now understand the logic behind fill and got it working okay. Thanks! Last question - would there have been any place to find this out on the web, or just by reading & understanding the source code?
 [2006-06-23 12:27 UTC] wiesemann (Mark Wiesemann)
> Last question - would there have been any place to find > this out on the web, or just by reading & understanding > the source code? Currently there is little documentation about it, in fact there is only the complex example in the manual that shows how to use fill() with the HTML_Table package. We will improve and extend the documentation, but this might take some time. If you want to help us with this job, please contact us.
 [2006-06-23 21:00 UTC] olivierg at php dot net (Olivier Guilyardi)
Help with writing documentation would indeed be welcome. You might want to read the following explanation on how to write docs: http://pear.php.net/manual/en/developers.documentation.php If you checkout and improve the SDG CVS DocBook manual, you can simply post patches here and we'll try to include them.
 [2006-06-29 22:45 UTC] olivierg at php dot net (Olivier Guilyardi)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. New example on the fill() page