NYCPHP Meetup

NYPHP.org

[nycphp-talk] Dynamic Form Elements

Michael B Allen ioplex at gmail.com
Fri Feb 1 11:59:59 EST 2008


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/



More information about the talk mailing list