Hello,
I'm looking forward to make developing forms easier for me.. and so i have done some researchs and ended up with these two frameworks:
patForms: http://trac.php-tools.net/patForms
PHPClasses.orgForm Generation: http://www.phpclasses.org/browse/package/1.html
both are good... but i love patForms more, and it has excellent documentation.. but it seems it's not supported that well or bit neglected in another word.
My question.. Do you have any other suggestions like the above? i would approciate it and what do you think about the above frameworks?
Thanks in advance,
Samer
Automatic form generation suggestion...
Moderator: General Moderators
-
powerful0x0
- Forum Newbie
- Posts: 7
- Joined: Fri Apr 06, 2007 12:46 pm
There's always HTML_QuickForms
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
unless of course you have some reasonably simple forms. I still use HTML_QuickForm on my projects, but it is definitely not ideal. I don't even use the renderer because I just really don't think my form validator has any business rendering my form (
). I like having 100% control over my html. I build the form html on my own and integrate a whole seperate system for error reporting using views and view helpers. Something along the lines of...
Form controller function
Application Controller:
Form controller function
Code: Select all
public function _processDataAdd()
{
$form = new HTML_QuickForm('add_calendar');
$title = new HTML_QuickForm_text('calendar_title');
$form->addElement($title);
$description = new HTML_QuickForm_textarea('calendar_description');
$form->addElement($description);
$admin_must_allow = new HTML_QuickForm_text('calendar_admin_must_allow');
$form->addElement($admin_must_allow);
$form->applyFilter('__ALL__', 'trim');
$form->addRule('calendar_title', 'This is required', 'required');
$form->addRule('calendar_title', 'This cannot be over 100 characters', 'maxlength', 100);
$form->addRule('calendar_description', 'This cannot be over 5000 characters', 'maxlength', 1000);
return $this->_processForm($form);
}Code: Select all
protected function _processForm(HTML_QuickForm $form, $include_wrap = true)
{
if ($form->validate())
{
return $form;
}
$errorPrefix = '';
$errorSuffix = '';
if ($include_wrap)
{
$errorPrefix = '<span class="error">';
$errorSuffix = '</span';
}
foreach ($form->_elements as $element)
{
$error = $form->getElementError($element->getName());
if (!empty($error))
{
$this->_view->setFormError($element->getName(), $errorPrefix . $this->_view->escape($error) . $errorSuffix);
}
$this->_view->setFormValue($element->getName(), $form->exportValue($element->getName()));
}
return false;
}Code: Select all
<?php if ($this->formIsError()): ?>
<div class="alertError">One ore more fields were not filled out correctly. Please revise and submit again.</div>
<?php endif; ?>
<div><label> Event title</label><?php echo $this->formCheckbox('event_title', $this->formValue('event_title')); ?></div>
<div><label> Event description</label><?php echo $this->formCheckbox('event_description', $this->formValue('event_description')); ?></div>
<!-- and so on... -->-
powerful0x0
- Forum Newbie
- Posts: 7
- Joined: Fri Apr 06, 2007 12:46 pm
Thanks for your responses...
no matter the automatic generation seems bit not under control but in my openion it's very good choice for maintaining web forms and their heaches, i guess you know all the silly errors that could happen while doing a form...
Smarty & Quickforms seems to be a very good solution if you know how to use it.
Checkout this link.. maybe its looks like more programming but this is much easier to maintain when you are working with many forms.
http://davidmintz.org/presentations/sho ... and_Smarty
no matter the automatic generation seems bit not under control but in my openion it's very good choice for maintaining web forms and their heaches, i guess you know all the silly errors that could happen while doing a form...
Smarty & Quickforms seems to be a very good solution if you know how to use it.
Checkout this link.. maybe its looks like more programming but this is much easier to maintain when you are working with many forms.
http://davidmintz.org/presentations/sho ... and_Smarty