html_QuickForm / CreateFormStart()

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
petert
Power Poster
Power Poster
Posts: 282
Joined: Wed Feb 09, 2005 9:30 pm
Location: behind my desk

html_QuickForm / CreateFormStart()

Post by petert »

Wishy,

I use  pear's HTML/QuickForm.php and HTML/QuickForm/Renderer/ArraySmarty.php to make my forms for the backend of CmsMS. It has validation (server AND client side!), own validation rules, proper template handling and much much more.
In order for the whole thing to work smoothly within CmsMS  I changed the definition of

Code: Select all

function CreateFormStart($id, $action='default', $returnid='', $method='post', $enctype='', $inline=false)
in

Code: Select all

lib/classes/class.module.inc.php
to

Code: Select all

function CreateFormStart($id, $action='default', $returnid='', $method='post', $enctype='', $inline=false, $extra=null)
I needed some html_quickform generated variables to be present in the defining opening tag, so I added the $extra variable to mentioned file. This way it is now possible to use the following construction for making the opening tag:

Code: Select all

$this->smarty->assign('formStart', '<div class="adminform">' . $this->CreateFormStart($id, 'edittrip', $returnid, 'post', '', '', ' onsubmit="return validate_edittrip(this);"'));
The last parameter is what this is all about. It makes it possible to NOT use the quickform generated form tags, but use the CmsMS tags.
The parameter can be either an array or a string, the logic is smart enought to make the right decission.

Could the source code for lib/classes/class.module.inc.php in the CmsMS sourcetree be extended by the code above, so my code won't break next time I do an update :)
I am working on a solution to 'read' the extra attributes that Quickform will generate, so the whole thing will be really dynamic.
Last edited by petert on Sun Aug 14, 2005 8:02 am, edited 1 time in total.
Mambo sucks, that's why I am here.
Now they call it Joomla, but it still sucks!

CMSMS rules!
Post Reply

Return to “Modules/Add-Ons”