Re: quickform2 radio labels and calendar insertion.

From: Date: Sat, 09 Mar 2013 23:50:50 +0000
Subject: Re: quickform2 radio labels and calendar insertion.
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-31750@lists.php.net to get a copy of this message
First off, your CSS has a missing ; so anything below that won't be processed. Two, radio and checkboxes (and maybe other elements) have an additional field that allow you to place content in the area to the right of the radio button: $fsCheck->addElement( 'radio', 'radioTest', array('value' => 1), array('content' => 'select radio #1', 'label' => 'Test radio:') ); The key "content" is what will show up next to your radio button. A great resource is the basic-elements.php file in the PEAR_Install_dir/doc/HTML_QuickForm2/ folder. Another way you could do this is to use renderers and change the element template and place the label to the right of the checkbox ... Take a look at the default-renderer.php file in the same folder as the basic-elements.php file for some code on using renderers. Let me know if you have any other questions. Mark On Thu, Mar 7, 2013 at 4:50 PM, george <george@followtrader.com> wrote: > I am not proud of the following. So feel free to criticise AND improve > as much as possible. :-) > <!DOCTYPE html> > <html> > > <head> > <meta http-equiv="content-type" content="text/html; charset=UTF-8" > /> > <META http-equiv="Content-Style-Type" content="text/css"> > > <title>LimoHere.com</title> > > <link href="../assets/bootstrap/css/bootstrap.min.css" > rel="stylesheet"> > <style type="text/css"> > .xtimex { > margin-top:0.8em; > width:8ex; > } > .xinp { > width:17ex; > } > .row { > margin-left: 1ex; > line-height: 16px; > *zoom: 1; > } > .element { > display:inline; > } > .labelRadio { > display:inline; > margin-left:4px; > } > .label, .badge { > width: 30ex; > text-align:right; > } > .labelShort { > width: 18ex; > } > .rightup { > margin: -37em 0 0 50ex; > } > legend { > font-weight: bold; > line-height:21px > padding-left: 5ex; > width: 24ex; > } > </style> > </head> > <body> > > <?php > // Load the main class > require_once 'HTML/QuickForm2.php'; > require_once 'HTML/QuickForm2/Container/Group.php'; > > require_once '../assets/php/xlib.php'; > > $form = new HTML_QuickForm2('reservForm', 'post', > array( 'action' => './process_reserv.php' > )); > //$_SERVER['PHP_SELF'])); > $form->setAttribute('style', 'width:150ex'); > //--------------------------------------------------------------------------- > $fs = $form->addFieldset('passFS')->setLabel("Passenger"); > > $newPass = $fs->addRadio('passengerGr', array('value' => 1)) > ->setContent("Current or "); > $newPass2 = $fs->addRadio('passengerGr') > ->setContent("new passenger information"); > > //, array('size' => 20, 'maxlength' => 255) > $fName = $fs->addText('firstName' )->setLabel("First Name" > )->addClass('xinp'); > $lName = $fs->addText('lastName')->setLabel("Last Name" > )->addClass('xinp'); > $aName = $fs->addText('strAddr')->setLabel("City" > )->addClass('xinp'); > $cName = $fs->addText('xcity')->setLabel("City" > )->addClass('xinp'); > $sName = $fs->addText('xstate')->setLabel("State" > )->addClass('xinp'); > $zName = $fs->addText('zipCode')->setLabel("Zip code" > )->addClass('xinp'); > $pName = $fs->addText('cellphone1')->setLabel("Cell phone" > )->addClass('xinp'); > $eName = $fs->addText('email')->setLabel("E-mail" > )->addClass('xinp'); > //$pName->addRule("required", "Please enter some comments"); > //--------------------------------------------------------------------------- > > $fs2 = > > $form->addFieldset('pickupFS')->addClass('rightup')->setLabel("Pickup > details"); > > $newPass = $fs2->addRadio('addressGr', array('value' => 1)) > ->setContent("Current or "); > > $newPass2 = $fs2->addRadio('addressGr') > ->setContent("new pickup details."); > $aName2 = $fs2->addText('2strAddr')->setLabel("City" > )->addClass('xinp'); > $cName2 = $fs2->addText('xcity2')->setLabel("City" > )->addClass('xinp'); > $sName2 = $fs2->addText('xstate2')->setLabel("State" > )->addClass('xinp'); > $zName2 = $fs2->addText('zipCode2')->setLabel("Zip code" > )->addClass('xinp'); > $pName2 = $fs2->addText('cellphone12')->setLabel("Cell phone" > )->addClass('xinp'); > $eName2 = $fs2->addText('email2')->setLabel("E-mail" > )->addClass('xinp'); > > //------------------------------------------------------------------ > $pDate = $fs2->addText('pickupDate')->setLabel("Pickup Date > (mm/dd/yyyy)" )->addClass('xinp'); > > class InlineInputs extends HTML_QuickForm2_Container_Group {} > HTML_QuickForm2_Factory::registerElement('inlineinputs', > 'InlineInputs'); > $drg = $fs2->addInlineInputs('inlineInputs')->setLabel(array('Time', > 'Select pickup time.')); > $pHr2 = $drg->addSelect('fromH') > ->setLabel("Time") > ->loadOptions(array('' => "12", "01", "02", > "03", "04", "05", "06", > "07", "08", "09", "10", "11", > "12")); > $pHr2->setAttribute('class', 'xtimex'); > > $pMin2 = $drg->addSelect('fromM') > ->loadOptions(array('' => ":00", ":15", > ":30", ":45")); > $pMin2->setAttribute('class', 'xtimex'); > > $pAm2 = $drg->addSelect('rsrvTimeAP')->loadOptions(array('' => > "AM", > "PM")); > $pAm2->setAttribute('class', 'xtimex'); > //$pTime = $fs2->addText('fromH')->setLabel("Time: " > )->addClass('xinp'); > > $charge = $fs2->addText('charge')->setLabel("Charge Amount" > )->addClass('xinp'); > //------------------------------------------------------------------ > //--------------------------------------------------------------------------- > // Add the submit button to our form (outside of our fieldset) > $form->addSubmit('submit', array('value' => "Book this > reservation.")); > > //zz > //$actions = $form->addActionInputs(); > //$actions->addSubmit(null, array('value' => 'Save > changes'))->addClass(array('btn', 'primary')); > //$actions->addButton(null, array('type' => > 'reset'))->setContent('Cancel')->addClass('btn'); > > // Apply the trim() function recursively on all form children elements > $form->addRecursiveFilter('trim'); > > if ($form->validate()) { > echo "Success"; // Use a redirect here... > } else { > echo $form; > } > > ?> > > > > > On Thu, 2013-03-07 at 16:24 -0800, Mark Steudel wrote: >> Post some code so we can see what you are doing. >> >> On Thu, Mar 7, 2013 at 1:51 PM, george <george@followtrader.com> wrote: >> > I am new to QF2. I've been struggling with setting up labels next to the radio >> > buttons (not on top of). (along with some other things - but those I worked out.) >> > bootstrap2.3 rule sets display:block on labels and I do not know how to change >> > css rule for those quickform2 labels only. >> > I also do not understand why this does not affect text labels. >> > Please, can you help? >> > Do I have to do custom rendering like Mansion did in his blog? >> > Is bootstrap2 that much different? >> > Of course I can provide all sources. >> > >> > issue #2 - How do I insert a calendar at the end of a date text field in the >> > middle of the form. >> > The calendar that I use is js based tigra. >> > >> > george >> > >> > >> > >> > -- >> > PEAR General Mailing List (http://pear.php.net/) >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> >> >> >> -- >> ----------------------------------------- >> Mark Steudel >> P: 425.298.7244 >> F: 206.260.3021 >> msteudel@gmail.com >> >> . : Adoption Updates : . >> http://www.steudel.org/blog >> >> . : Work : . >> http://www.mindfulinteractive.com >> >> . : LinkedIn : . >> http://www.linkedin.com/in/steudel >> > > > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- ----------------------------------------- Mark Steudel P: 425.298.7244 F: 206.260.3021 msteudel@gmail.com . : Adoption Updates : . http://www.steudel.org/blog . : Work : . http://www.mindfulinteractive.com . : LinkedIn : . http://www.linkedin.com/in/steudel

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