Thursday, July 30, 2009

Re: Form with saving of true/false/null

I have been giving this some thought and I do get what you mean, but
it is very important that the user can always change e.g. an "yes"
answer into "not info on subject". Database wise I think you are
right, that I should define three different values (no = 0, yes = 1,
no info = 2) instead of using no info = Null.

Thank you very much for your help.

/Anders

On Jul 30, 9:41 am, delocalizer <conrad.leon...@hotmail.com> wrote:
> You sure you want an explicit third option 'no information on the
> subject'? Wouldn't it be better to just have a radio group with 2
> buttons (Yes/No or True/False) with a default value of NULL for that
> field in your database? Or if you really want to have a third option
> to force a user to enter something, mapping to a value other than
> empty string or 'null' might be wise, as depending on how your db
> field is defined, these may not be distinguishable from 'no data
> entered'. The 'right' solution really depends on the particular logic
> of your application - what data your users should enter and how that
> data will be used and analysed once it's in the database.
>
> On Jul 30, 12:40 am, "Richard@Home" <richardath...@gmail.com> wrote:
>
> > I'd use a drop down select instead of an option group.
>
> > This should do the trick:
>
> > <?php echo $form->input("Model.field", array("options"=>array(""=>"No
> > information on subject", true=>"True", false=>"False))); ?>
>
> > On Jul 29, 12:29 pm, Kanten <anders.ho...@gmail.com> wrote:
>
> > > Is there really noone, that can help me with this one?
>
> > > Thanks
> > > Anders
>
> > > On Jul 10, 1:49 pm, Kanten <anders.ho...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I am making a database for research and for this project I have a lot
> > > > of dichotomous (binary) variables where I need to be able to
> > > > discrimate between true, false and "no information on
> > > > subject" (=null). I would like to store it as a bool field in MySQL.
> > > > User interface wise I was thinking of using radio buttons with the
> > > > option of choosing between the three posibilities.
>
> > > > Is there some easy way of doing this using the builtin form helper, or
> > > > do I need to to modify it somehow?
>
> > > > Thanks
> > > > Anders
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: