Re: Formbuilder generates extra radio button
| From: | Justin Patrin | Date: | Wed, 20 Jul 2005 23:39:02 +0000 |
| Subject: | Re: Formbuilder generates extra radio button | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20086@lists.php.net to get a copy of this message | ||
On 7/20/05, Andrew Wooldridge <andrew.r.wooldridge@vanderbilt.edu> wrote:
> I've changed the database and regenerated the dataobjects using
> createTables.php. Sadly I still see four rather than the expected three.
> If your next suggestion is to use a select instead of radio buttons, can you
> tell me how to make 'Unknown' the default rather than 'null'? :) -A
Are you sure that particular field is set up as "NOT NULL"? If it is
then this is likely a bug, as you said, although I have no idea how it
could be happening. Do you perhaps have selectAddEmpty set to true?
Setting selectAddEmptyLabel *should* change the text. If it doesn't
let me know and I'll look into it.
>
>
>
> On 7/20/05 5:51 PM, "Justin Patrin" <papercrane@gmail.com> wrote:
>
> > On 7/20/05, Andrew Wooldridge <andrew.r.wooldridge@vanderbilt.edu> wrote:
> >> I'm using the following code to create a yes, no, unknown field using
> >> FormBuilder. The data field is a char(1) in my database. I have the
> >> following lines in my dataobject class. However, the HTML created has a
> >> fourth radio button, without a label, before the others.
> >>
> >> ---partial listing of options set in data object---
> >> public $y_n_u; // string(1)
> >>
> >> $this->fb_linkElementTypes = array('y_n_u' =>
> >> 'radio');
> >>
> >> $this->fb_enumFields[] = 'y_n_u';
> >>
> >> $this->fb_enumOptions = array('y_n_u' => array('Y'
> >> => 'Y',
> >> 'N' =>
> >> 'N',
> >> 'U' =>
> >> 'U') );
> >>
> >> ---HTML generated -----
> >>
> >> <td valign="top" align="center">
> >> <input name="test1_y_n_u_1" value="" type="radio"
> >> id="qf_51da48"
> >> checked="checked" />
> >> <input name="test1_y_n_u_1" value="Y"
> >> type="radio" id="qf_47f93e"
> >> /><label for="qf_47f93e">Y</label>
> >> <input name="test1_y_n_u_1" value="N"
> >> type="radio" id="qf_4facaf"
> >> /><label for="qf_4facaf">N</label>
> >> <input name="test1_y_n_u_1" value="U"
> >> type="radio" id="qf_7a549b"
> >> /><label for="qf_7a549b">U</label></td>
> >>
> >> -----------------------------
> >>
> >> Has anyone else seen this problem before?
> >
> > It's not a problem, it's a feature. ;-)
> >
> > I'm pretty sure that what's happening is that FormBuilder is adding an
> > extra option because the field is allowed to be NULL. I.e. it's not
> > NOT NULL. If you change your field in the DB to NOT NULL and
> > regenerate your DO ini file you'll see that go away.
> >
> > You may be right in a way, though...a "nothing" radio button doesn't
> > make as much sense as a "nothing" select box entry. However, not
> > having the "nothing" radio button means that once you click yes or no
> > you won't be able to go back to choosing nothing in most browsers.
> >
> > I suggest you just make your field NOT NULL. :-)
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Justin Patrin