How to hide/show span based on select object value
Posted on 2006-07-08
The objects and spans on the page are dynamically named because the page displays multiple records that can updated all at once. Each record has its own "Interval" dropdown menu. I've named these Interval cfselect controls "Interval#ServiceItems.ClientServiceID#. There are several spans per record, each named "Day#ServiceItems.ClientServiceID#", "Week#ServiceItems.ClientServiceID#", "Month#ServiceItems.ClientServiceID#", etc.
When a user changes the value of a dropdown named "Interval555" to "Day", I want to display the contents within the Day555 span... some Day-specific text boxes, etc. When the user selects "Month",... same thing: hide the Day555 span and show the Month555 span. The same thing for the record right below -- When a user changes the cfselect named Day556 to "Week", show the contents of the span named "Week556" and hide the other -556 spans.
It seems like a simple Java function could account for the Interval chosen (Day, Week, etc) and the current record ID (CSID) and show/hide the related spans accordingly.
I'm not very experienced with Java, as you can tell. Any help is hugely appreciated. Also, I'm not bent on using spans... if you think a <div> is better, that's cool.
Thanks in advance for any help!
function ToggleVisible(Interval, CSID)