NYCPHP Meetup

NYPHP.org

[nycphp-talk] Dynamic Form Elements

Jake McGraw jmcgraw1 at gmail.com
Fri Feb 1 12:12:43 EST 2008


Btw, not to go OT or start a js framework war, I highly recommend
jQuery for any DOM manipulation tasks like the one you describe here.

- jake

On Feb 1, 2008 11:59 AM, Michael B Allen <ioplex at gmail.com> wrote:
> On 2/1/08, Allen Shaw <ashaw at polymerdb.org> wrote:
> > Michael B Allen wrote:
> > > Basically I just want to dynamically insert or remove one element in a
> > > form. The form is normally just a select with a submit button
> > > immediately to it's right. But depending on what option in the select
> > > is selected, I want another select to be inserted between the first
> > > select and the button.
> > >
> > > So it's either <select1><button> or <select1><select2><button>.
> > >
> > > I would be perfectly happy with toggling the style visibility: visible
> > > or visibility: hidden but this doesn't change the position of the
> > > button. It always appears off to the right. I want the form to
> > > re-pack.
> > Hi Mike,
> >
> > The properties you want to mess with on <select2> are display (not
> > visibility) and disabled.
> >
> > var select2 = document.getElementById('select2')  // or however you want
> > to go about defining select2
> >
> > To turn off <select2> use something like this:
> > select2.style.display = 'none'; // this will collapse select2 so it
> > takes up no space and is invisible
>
> Bingo. That is exactly what I want. It works like a champ.
>
> Thanks,
> Mike
>
> --
> Michael B Allen
> PHP Active Directory SPNEGO SSO
> http://www.ioplex.com/
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>



More information about the talk mailing list