Re: HTML_QuickForm Builder
| From: | Alan Knowles | Date: | Sun, 25 May 2003 03:51:42 +0000 |
| Subject: | Re: HTML_QuickForm Builder | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16661@lists.php.net to get a copy of this message | ||
This is something that has been chatted about a bit with the QF/Flexy and Xipe integration.
Below is a breif overview of some of the theory behind flexy/QF integration. - more as a backgrounder on one of the 'many uses of QF at present' and how it might related to a 'standard'/xml format for qf..
At the moment Flexy parses a HTML page(template) containing HTML Form elements, and builds a big 'constructor' array / sub arrays etc, enough to build the quickform elements at runtime.
After extensive research, I came to the conclusion that putting validation in either this data file or the template was to problematic, so I ended up creating a new validation layer seperate from quickforms (based around pear::validate)
At present, the description of the form, is done by just serializing the php array. (that builds the quickform) - as in flexy's case you shouldnt touch it manually.. - but the is no reason that it couldnt be used to generate a 'standard format' - although I dont really want to add the weight of a full xml parser/writer to the code.. - ini or wddx (and sterlings simplexml?) are the only ones that would are prefered due to performance consideration, also, are very lightweigth codewise.
Obviously Flexy's primary goal is to make the forms and html pages totally editable in dreamweaver/mozilla/frontpage whatever.. - so that changes to the layout are not done at the php code level. - eg. you can see what the form is going to look like at design time/rather than run time.
So some of the issues it faces are a little different to 'classic' qf usage.
to give you some idea of the process..
Part of Flexy At present: = the qf data parser/store.
http://cvs.php.net/co.php/pear/HTML_Template_Flexy/examples/example.html.en.php?r=1.8
the [elementsDefArray] (halfway down the page) gives you an idea of the data that is parsed and stored to generate a quickform.
Part of a New Validation layer:
Config file storing user defined validation
http://www.akbkhome.com:81/svn/hebehaven2/ValidateHebe.php.wddx
User Defined validation class (built from previous config file)
http://www.akbkhome.com:81/svn/hebehaven2/ValidateHebe.php
a form's set of rules
http://www.akbkhome.com:81/svn/hebehaven2/templates/reports/member.html.rules.wddx
the class to run validation on a form.
http://www.akbkhome.com:81/svn/akpear/Gtk_ValidateManager/ValidateManager/Base.php
(gives an idea of the simplicity of parsing wddx)...
The gtk interface to editing form validation rules
http://www.akbkhome.com:81/svn/akpear/Gtk_ValidateManager/
and some fun screenshots..
http://devel.akbkhome.com/gtk_validatemanager1.jpg
http://devel.akbkhome.com/gtk_validatemanager2.jpg
Unfortunatly, since I've already got to much on my hands in maintaining other projects.. - this little tool is probably not going to be supported as well as it should be.. :(
------------
Well, most of that is for information only :) -- unless anyone wants to start digging into the mysteries of QF/Flexy integratoin..
Regards
Alan
Yavor Shahpasov wrote:
Hello ,
instead of studing for my final today I was playing with HTML Quick form. I came up with a builder which reads an xml file and produces a form using HTML Quick Form as backend. I currently can support default and elements, everything passed in the element which is not type,text,name or data is passed as attributes to the addElement
. It desparately needs quickform rules to be added to it as it currently does not support them.
find it here http://mail.itenasolutions.com/~yavo/pearform/PearFormBuilder.zip
This is merely a quick hack I don't know if anyone would be interested in it, I think it help separation of form building from php code which IMHO is a good thing, I don't know if I would work on it more it was merely a weekend hack, but I guess it depends on my laziness and how much people are interested in it.
Yavor
PS:
this is what the xml file looks like
<?xml version="1.0" ?>
<pear:form>
<name>frmLogin</name>
<method>post</method>
<action>?</action>
<defaults>
<default>
<name>password</name>
<value>nopass</value>
</default>
</defaults>
<elements>
<element>
<type>header</type>
<text>Login Form</text>
<name>login_header</name>
</element>
<element>
<name>username</name>
<type>text</type>
<text>Username:</text>
</element>
</pear:form>
--
Can you help out?
Need Consulting Services or Know of a Job?
http://www.akbkhome.com