HTML Template Flexy: Cannot display error ffrom grouped items
| From: | n | Date: | Sun, 11 Jan 2004 21:55:13 +0000 |
| Subject: | HTML Template Flexy: Cannot display error ffrom grouped items | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10121@lists.php.net to get a copy of this message | ||
I'm trying to set up a validation such that the app will allow a user to
enter text in a box OR select an option from a drop down, but not both.
I've set up the input elements using a QuickForm object, and have verified
that the rule is correctly verifying the 2 input elements. I've also
verified that the style sheet syntax is correct in that I can correctly
print out other error messages. In addition, I've used the accompanying
examples as reference.
Here is how I've added the element and rule to the form. (I've excluded the
callback func for brevity):
$cityInputs[]=&HTML_QuickForm::createElement('select','selectCity','Select
City:',$cities,array('class'=>'input',
'tabindex'=>2));
$cityInputs[]=&HTML_QuickForm::createElement('text', 'addCity', 'Add
City:',array('class'=>'input',
'maxlength'=>$Fusebox["locationCity.maxLength"],
'size'=>20,
'tabindex'=>3));
$form->addGroup($cityInputs,'locationCity','City:',' ');
.
.
//if the user has chosen to input a city, they can either select a city
from the drop
//down list box or input one in the text box, but not both
$form->registerRule('checkLocationCity', 'callback',
'checkLocationCity');
$form->addRule('locationCity', 'Please either select a city from the list
OR type a new one in the text box, but not both.', 'checkLocationCity');
Here is the HTML from the template:
<tr id="cityRow" align="{tr_align}" valign="{tr_valign}" >
<td class="text" width="{label_width}"
>{form.locationCity.label:h}</td>
<td class="text" width="{input_width}">
{form.locationCity.error:h}
<table border=1 cellpadding="{table_cellpadding}">
<tr align="{tr_align}" valign="{tr_valign}">
<td class="text">{form.locationCity.selectCity.label:h}</td>
.
.
.
Here is my html.html file:
{if:error}
<span class="error">{error:h}</span><br />
{end:}
{html:h}
The expected output is for the error message is to print the error including
the HTML "adornment". However the actual output is the error message only,
i.e. no surrounding span tag. Any thoughts on what I'm doing wrong?