--- Dave Howorth <Dave.Howorth at acm.org> wrote:
> Peter Speltz wrote:
> > Dave Howorth wrote:
> >> I'm looking at the addnew form for a table that has a foreign key
> >> that is allowed to be null. AsForm has generated a select box for
> >> it, which is good (modulo the other issues we know about :) But
> >> it's populated the select box with all the existing keys. There
> >> doesn't seem to be any way to say that I want a NULL value for this
> >> field in my new record.
> >
> > Not sure i understand. Are you saying you want a select box with a
> > NULL option on top so you can select that? Search form does that by
> > unshifting a HTML::Element (option) to the respective select element.
> > See that template.
>
> Yes, that's exactly it. Thanks a million for the pointer, Peter.
>
> > I've been working on AsForm and this was a question i had, should it
> > add a "None" option by default. Can't remember but something told me
> > this was a bad idea. Oh yeah, NOT backward compatible. Most of my
> > cases i don't need this and its easy to add one on your own. But
> > some apps may need this more times than not in which case they may
> > benifit if the exception was deleting the first "NONE" option from
> > the select box generated by AsForm rather than adding a NONE option.
> > Thoughts anyone
>
> It seems to me there are several cases :)
> There's a difference between the desired behaviour of a search form and
> an add new form, and there's a difference between the desired behaviour
> depending on whether the data type allows NULL or not.
>
That's a good idea If it can be null asform will make a none option. Else, just
select from existing objects.
> Data Type Operation Behaviour
> --------- --------- ---------
> NOT NULL search allow existing values or "Don't Care"
> NOT NULL add new allow existing values only *
> can be NULL search allow existing values, NULL and "Don't Care"
> can be NULL add new allow existing values and NULL
>
Hmm. new can of worms.
> * There's conceivably another possible option here, which is a push
> button to create a new value of the associated record first.
>
I solved this one. no push button, thats templates job, just inputs for has_a
column class rather than select box. see AsFormImproved, next email.
> IMHO, it's more natural for the code (i.e. AsForm) to generate all the
> data-dependent values (i.e. all the valid values including NULL where
> required). I could be persuaded either way about the "Don't Care" (i.e.
> whether it's more natural for the code or the template) but that bit
> isn't broken, so let's not fix it!
>
> I'm eagerly awaiting your revised code :)
>
I'm eager to get feedback so i can move one :) Its hard to code when the api is
up in the air. Probably spent a week on this. I'm still new to perl so i
learned a lot.
=====
pjs
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole
This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT