Re: [Maypole] AsForm again - selects?

From: Peter Speltz (peterspeltz at yahoo.com)
Date: Thu Dec 09 2004 - 18:42:24 GMT


--- Dave Howorth <dhoworth at mrc-lmb.cam.ac.uk> 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.
>
> I have SQL like this:
>
> CREATE TABLE a_table (
> id INT NOT NULL,
> fk INT,
> FOREIGN KEY (fk) REFERENCES another_table (id)
> ) TYPE=InnoDB;
>
> and code like this:
>
> ATable->has_a( fk => 'AnotherTable' );
> AnotherTable->might_have(entries => 'ATable', 'fk');
>
> Is there something else I should be configuring or do I need to think
> about overriding AsForm?
>

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.

> maypole.perl.org seems to be down, so I couldn't check if
> <http://maypole.perl.org/?ImprovedAsForm> has anything new.
>

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

P.S.
I'm going to send out my AsForm.pm to you and maintainer for thoughts on it,
very soon. It is general, backward compatible and much more functional. Well
written? That's another story. :) I'm struggling getting the pod to look good
now but in a few hours.
 
> BTW, I'm frequently having trouble getting to perldoc.com over the past
> few weeks. Is this a shared problem? Are there mirrors?
>
> Thanks, Dave
>
>
> _______________________________________________
> maypole mailing list
> maypole at lists.netthink.co.uk
> http://lists.netthink.co.uk/listinfo/maypole
>

=====
pjs

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

_______________________________________________
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