Pear QuickForms -- How do I integrate CSS?

I'm working my way through PEAR and using the QuickForms.  I have only been working with PEAR for a few days now.

How can I change element classes?  All the elements are labeled 'class="element"'.  What if I want 'class="address"'?

Also, is there a way to stick in a div or span tag?

It would seem there has to be a way to integrate CSS style sheets, but I can't find it.

I've attached the code I'm working with.  I want to be able to make the address textarea separate from the rest of the elements so I can position it to the right of the name, phone, email fields.

Thanks,
Frank
<?php
 
require_once 'HTML/Page2.php';
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/Tableless.php';
 
$page = new HTML_Page2();
$page->setTitle('Personal Information Form');
 
$page->addStyleDeclaration('
div.table {
    border: 1px solid #000;
}
 
li { 
display: inline;
}
 
');
$renderer =& new HTML_QuickForm_Renderer_Tableless();
$form =& new HTML_QuickForm('PersonalInfo');
 
$form->addElement('header', null, 'Personal Information Form');
 
$intro = "Hi, this is the intro.<p>";
 
$form->addElement('static', '', '', $intro);
 
$form->addElement('text', 'name', 'Name', array('size' => 50, 'maxlength' => 255));
$form->addElement('text', 'phone', 'Phone', array('size' => 50, 'maxlength' => 255));
$form->addElement('text', 'email', 'Email', array('size' => 50, 'maxlength' => 255));
$form->addElement('textarea', 'address', 'Address', array('wrap' => 'virtual', 'rows' => 8, 'cols' => 50));
 
if ($form->validate())
  {
    $form->freeze();
  }
 
$form->accept($renderer);
$htmlout = $renderer->toHtml();
 
$page->addBodyContent($htmlout);
 
$page->display();
 
?>

Open in new window

ibanjaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve BinkCommented:
Try something like this:


$form->addElement('textarea', 'address', 'Address', array('wrap' => 'virtual', 'rows' => 8, 'cols' => 50, 'class' => 'address'));

Open in new window

ibanjaAuthor Commented:
Thanks routinet,

I've tried that.  I should have been more clear... I wanted to have more control over the "li" or "label" tags that are generated.  Also, i wanted to add div and span tags.

Steve BinkCommented:
The API documentation does not appear to support that depth of control.  To move forward with this, you'll be digging into the class code for QuickForms and the Renderer.  You could certainly extend the code to do exactly what you want, but this will not be a quick fix.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ibanjaAuthor Commented:
routinet,

Yep, I think I'm going to write my own class, or possibly extend existing classes.

Thanks for the help.  

Frank  
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.