> -----Original Message-----
> From: Che Vilnonis [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 02, 2007 2:53 PM
> To: CF-Talk
> Subject: OT: JS Question Hide/Show Form Elements
> 
> Anyone know of a JS that works on *most* browsers that will allow me to
> hide/show sections of a form depending on what radio button is clicked?
> I've
> found a few, but they don't seem to work with all browsers.

You could do this with my PanelManager:

http://www.depressedpress.com/Content/Development/JavaScript/Extensions/DP_P
anelManager/Index.cfm

Just segment your form into DIVs with IDs and add those DIVs to the Panel
Manager.  You can then access panel manager methods directly from the DIVs.

For example if one of your DIVs was called "FormSection1" you'd create it as
a panel like so:

  // Create a Panel Manager for the Menu
FormPanels = new DP_PanelManager();
  // Create Panels
FormPanels.addPanel("FormSection1");

This adds a tons of methods to your DIV. Now any reference you get to the
DIV will allow access to those methods.  For example to "hide" the element
do this:

document.getElementById("FormSection1").setDisplay("none");

Actually it's even a little easier because the setDisplay() supports a value
of "toggle" that will show the element if it's hidden and hide it if its
showing.

You can also modify the size, position, opacity and other properties of the
panel.  For example if you want the form section to fade out for 100ms
before it disappears do this:

document.getElementById("FormSection1").shiftOpacity(0, 0, 100);
document.getElementById("FormSection1").setDisplay("none", 100);

That tells the panel to fade out to 0 opacity for 100ms and to wait 100 ms
before changing the display (remember both lines will run at the same time
thus the delay).

The component has been tested in IE, FireFox and Opera.

Jim Davis


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285265
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to