PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Changing Element layout of HTML_Quickforms

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML
View previous topic :: View next topic  
Author Message
mobbbx



Joined: 04 Aug 2009
Posts: 5
Location: Indonesia

PostPosted: Tue Aug 11, 2009 7:31 pm    Post subject: Changing Element layout of HTML_Quickforms Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1230

PostPosted: Wed Aug 12, 2009 9:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement