[TYPO3-ect] Forms Library status
R. van Twisk
typo3 at rvt.dds.nl
Fri Jul 14 01:58:09 CEST 2006
Christoph Koehler wrote:
> Ingo,
>
>
>
>> renderStringBox()
>> renderCheckBox()
>> ...
>>
>
> That's what I or we had in mind. A basic class that just renders the
> forms, taking an array of config options as an argument, and then
> subsequential classes building on top of that one.
>
> Thanks for the tips though!
>
> Christoph (getting ready for a weekend in the Rockies to fish at some
> remote lake :) )
> _______________________________________________
>
We current use a method that looks like this:
// Page 1 of form:
$p1 =& $a->createPage( 'Name' );
$b=array();
$b[] = new LtgForms_NotEmpty;
$b[] = new
LtgForms_RedirectInDb('http://www.google.com/','country', 'province',
'city', 'neighborhood');
$temp_behavior = new LtgForms_CreatePageIfNotInDb ( 'hotel',
'hotelinsertid', 'country', 'province', 'city', 'neighborhood');
$b[] = $temp_behavior;
$b[] = new LtgForms_CreatePageIfNotInDb_ConfirmCreation(
$temp_behavior );
//$b[] = new LtgForms_SetUidAsPostVar($varkey_pages_uid,
'country', 'province', 'city', 'neighborhood');
//$b[] = new LtgForms_UpdateDb ($table, $field,
$postvar_key_of_uid);
$p1->appendWithLabel( 'Hotel', new
LtgForms_AjaxTextField('hotel',$b,$entry));
$p1->appendSubmit( new LtgForms_AjaxSubmitButton('back', 0));
$p1->appendSubmit( new LtgForms_AjaxSubmitButton('action'));
$p1->addBehavior( new LtgForm_SuggestionProperty('hotel',
'hotel', 'country', 'province', 'city', 'neighborhood'));
// Page 2:
$p2 =& $a->createPage( 'Description' );
$p2->appendWithLabel( 'Description of Hotel',
new LtgForms_AjaxTextArea('description',
array( new
LtgForms_UpdateDb ( $lt->descriptionTable, $lt->descriptionField, '',
'hotelinsertid') ),
$description_entry)
);
$p2->appendSubmit( new LtgForms_AjaxSubmitButton('back', 1));
$p2->appendSubmit( new LtgForms_AjaxSubmitButton('action'));
The above is part of a multi step form with ajax behaviors it can
include checking of various data types aswell (Not all is included in
our current lib).
it does allow posting various values of one form into multiple tables.
You can step back and forth between pages and can handle branching of
forms (
show a different from upon previous entry). It also can handle
suggestions from database entry's or can find information in pages under
a sub page (find me all hotels under this and that city or country).
We decided to use a method as shown above because it allows for a lot of
flexibility, the downside is they are not easy.
However I do strongly believe that forms are complex and everybody does
have different needs so the form must be flexible into the extreme.
We did try to make it as OO as possible (not easy...really not.....) we
use different ajax techniques.
We use a dispatcher technique using so_jpspan (something I implemented
in 2004) to dispatch ajax request to various extensions
(a extension needs to register for this) and we are usingthe new
lightweight eID method if we need something reasonable fast. And we are
going
to do something outside of typo3 for extremely fast ajax calls (for
example give me this city under this country world wide, we have
+6.000.000 citys
in our database, all provinces and countys. We also have a spatial DB
where a user can point on any area in the world and we know the closest
city).
I don't want to walk to much from the forms...
So the above method tries to make a OO approach of creating form in a
flexible way with behaviors. We try to make everything as OO as possible.
We are currently working to make help text available as well is showing
appropriate errors messages,
Was this more thought ... I am not sure... just wanted to share I
guess..... going back in my hide out now.....
Cheers,
Ries
--
Ries van Twisk
Freelance Typo3 Developer
=== Private:
email: ries at vantwisk.nl
web: http://www.rvantwisk.nl/freelance-typo3.html
skype: callto://r.vantwisk
=== Work:
email: ries at livetravelguides.com
web: http://www.livetravelguides.com
More information about the TYPO3-team-extension-coordination
mailing list