Re: [PEAR] quickform2 radio labels and calendar insertion.
[email protected] (george)
| Newsgroups | php.pear.general |
|---|---|
| Message-ID | <1362703808.13657.5.camel@me-1> |
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 <[email protected]> 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
> [email protected]
>
> . : Adoption Updates : .
> http://www.steudel.org/blog
>
> . : Work : .
> http://www.mindfulinteractive.com
>
> . : LinkedIn : .
> http://www.linkedin.com/in/steudel
>