 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
mobbbx
Joined: 04 Aug 2009 Posts: 5 Location: Indonesia
|
Posted: Tue Aug 11, 2009 7:31 pm Post subject: Changing Element layout of HTML_Quickforms |
|
|
Hi,
Is it possible to change the element layout of HTML_Quickform? The default layout is one element per row. However, i want to have 2 elements per row. I managed to do it using groups but it is causing some problems.
My code for group:
| Code: |
$group[issue] =& HTML_QuickForm::createElement('text', 'date_issue', 'Date Issued: ', array('size' => 17, 'maxlength' =>17, 'readonly' => 'readonly'));
$group[expect] =& HTML_QuickForm::createElement('jscalendar', 'date_expect', 'Date Expected: ', array('ifFormat' => '%d/%m/%Y'));
$group->setValue(array("date_issue" => $today));
$form->addGroup($group, 'date', 'Date Issued:', ' Date Expected:'); |
However, with group, i cannot set the default value and the label for 'Date Issued' cannot be bold. And i will need the values from the dates for sql statements after clicking submit button.
Many thanks! |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1230
|
Posted: Wed Aug 12, 2009 9:48 pm Post subject: |
|
|
Using setValue() isn't recommended. Please use $form->setDefaults() with an array of the elements' values (and "subarrays" for group values), e.g.:
| Code: |
$form->setDefaults(array('fieldname' => 'value', 'groupname' => array('groupfieldname' => 'value')));
|
The values of groups are also stored in arrays. The output of var_dump($form->exportValues()); should help you.
About the styling in groups: You can add a 'static' element as the second element to the group to simulate a label for the (formerly) second element. Other options are the ElementGrid package for QF or the modification of the template for this group. The choice depends on how complicated your needs are. Maybe the first suggestion is already enough? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|