QuickForm - few patches.
| From: | Wojciech Gdela | Date: | Sun, 14 Apr 2002 23:52:35 +0000 |
| Subject: | QuickForm - few patches. | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-5491@lists.php.net to get a copy of this message | ||
Hello,
I've made some changes in QuickForm and now I can do something like
this:
$grp = array();
$grp[] =& $form->createElement('radio', '', 'young',
'I\'m young');
$grp[] =& $form->createElement('radio', '', 'old', 'Very
old');
$grp[] =& $form->createElement('radio', '', 'exact',
'Exact age:');
$grp[] =& $form->createElement('text', 'years');
$form->addElementGroup($grp, 'How old are you?', 'age');
And it will produce output like this:
How old are you? ( )I'm young ( )Very old ( )Exact age: [ ]
And I'll get two variables: $age with possible values 'young', 'old',
'exact', and $years with value entered by user.
With this changes it is also possible to only visualy group elements,
not connecting them logicaly. Each element has its name, as long as
the name is specified. Orginal version of QuickForm always changes
elements name to group name with square brackets.
If you like my changes I'll send patches to someone who can commit
them to cvs.
I've also found a bug in select element - the name was not changed
when it was multiple select, below is a patch for this.
*** /home/httpd/pear/HTML/QuickForm/select.php Sun Apr 7 23:10:34
2002
--- pear/HTML/QuickForm/select.php Sun Apr 14 23:15:20 2002
***************
*** 67,71 ****
HTML_QuickForm_element::HTML_QuickForm_element('select',
$elementName, null, $attributes);
if ($this->getAttribute('multiple') AND
strpos($elementName,']')<2)
! $elementName = $elementName.'[]';
if (isset($options)) {
$this->load($options);
--- 67,71 ----
HTML_QuickForm_element::HTML_QuickForm_element('select',
$elementName, null, $attributes);
if ($this->getAttribute('multiple') AND
strpos($elementName,']')<2)
! $this->setName($elementName.'[]');
if (isset($options)) {
$this->load($options);