Hello, The following code will add the two elements at different lines. How can I add elements at the same line ?
$form->addElement('date','from',Null,$options);
$form->addElement('date','to'," ~ ",$options);
$form->Display();
How can I add two elements at the same line ?
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
I use pear HTML_QuickForm
$form = new HTML_QuickForm('frmMain','post','');
Two selects will show on two lines. May I make it on the same line ?
Two selects will show on two lines. May I make it on the same line ?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
My code
May I add the two select element as the same line ?
<?php
require_once "HTML/QuickForm.php";
$form = New HTML_QuickForm();
$options = array( 'language' => 'en',
'format' => "Y-m-d",
'minYear' => 2002,
'maxYear' => 2006);
$form->addElement('date','from',Null,$options);
$form->addElement('date','to',Null,$options);
$form->display();
?>
<?php
require_once "HTML/QuickForm.php";
$form = New HTML_QuickForm();
$options = array( 'language' => 'en',
'format' => "Y-m-d",
'minYear' => 2002,
'maxYear' => 2006);
$form->addElement('date','from',Null,$options);
$form->addElement('date','to',Null,$options);
$form->display();
?>
It is probably safe enough to assume he is using PEAR's HTML_QuickForm package. Unfortunately, i have no prior experience with that myself.
It's e.g. possible by grouping the elements
Code: Select all
<?php
require_once "HTML/QuickForm.php";
$form = New HTML_QuickForm();
$options = array(
'language' => 'en',
'format' => "Y-m-d",
'minYear' => 2002,
'maxYear' => 2006
);
$form->addElement('group', 'myGroup',
array('period') /* element label(s) */,
array( /* elements */
HTML_Quickform::createElement('date', 'from', null, $options),
HTML_Quickform::createElement('date', 'to', null, $options)
),
array( ' till ') /* separator */
);
$form->display();
?>