Re: Pear formatting question

From: Date: Tue, 28 Mar 2006 01:36:15 +0000
Subject: Re: Pear formatting question
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-23463@lists.php.net to get a copy of this message
Hi James, While I am CERTAINLY no expert at Quickform, I have found a nice little system. In each of my forms, I overwrite the renderer with my own code--and put the form, each question, each group, the submit group, error and required messages, and notes into CSS <div>s and <span>s. /* renderer information */ $renderer =& $oForm->defaultRenderer(); $renderer->setFormTemplate('<form {attributes} class="large">{content}</form>'); $renderer->setElementTemplate('<div class="formQuestion"><span class="bold">{label} <!-- BEGIN required --><span class="required">*</span><!-- END required --></span> {element}</div><!-- BEGIN error --><div class="errorText">{error}</div><!-- END error -->'); $renderer->setHeaderTemplate('<div class="formHeader">{header}</div>'); $renderer->setGroupTemplate('<div class="formSubmit">{content}</div>','grpSubmitReset'); $renderer->setGroupElementTemplate('{element}','grpSubmitReset'); $renderer->setRequiredNoteTemplate('<div class="note"><span class="required">*</span> indicates Required Field</div>'); You might be able to modify my code, but basically, I rewrite the default displays of each of the elements. I removing all of the table code, and wrap each question in a <div> tags. Then, I wrap the question text in <span> tags within each question <div> so that it can then be declared a block-level element on the style sheet--yet, the questions are left as single units. Once everything is wrapped in a <div> and <span> tags, you can control all the appearances from the style sheet and do not need to touch the PEAR stuff at all. I use the class designation rather than ID tags, and a single declaration for each class formats all the questions at once. Hope that helps. -Tim >Greetings all. > >I've been using QuickForms for a week or two and I'm >really liking it. I'm attempting to customize/format >a few pages using and I'm running into formatting >issues. I figure maybe if someone out there could >offer some advice, I'd greatly appreciate it. I've >learned from this package it sometimes requires out of >the box thinking, and I need to become more accustomed >to this. In any case, here is what I'm wondering: > >1) I'm trying to insert raw HTML directly after an >input field but am unable to figure out a way. If I >wanted to insert a "<br />" directly after the input, >such that this input: > ><input name="Login" type="text" /> > >Becomes: > ><input name="Login" type="text" /><br /> > >Is there any easy/plausible way to do this without >modifying the library functions? > >I've used both > >$form->addElement('static','info','<br />'); > >and > >$form->addElement('html','<br />'); > >But the problem with these is that it just adds >another <tr><td><br /></td></tr> _after_ the form. > >2) In addition to this, when I insert static/html >using the aforementioned method (or any method for >that matter) QuickForms adds the bold tag (<b>Stuff >Here</b>) automatically, and I haven't found a way to >disable this. If anybody can help that would be great! > >_____________________ >James Reinke > >CLEVERSAFE > >MOBILE 847.340.7581 >jreinke@cleversafe.com > >_____________________ > > --------------------------------------- * Timothy Marsolais * * http://www.Technology-Works.Net * * 916.996.6542 * * Build Projects that Matter * ---------------------------------------

« previous php.pear.general (#23463) next »