House of Fusion
Home of the ColdFusion Community

Search cf-talk

December 02, 2008

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31       

Search over 2,500 ColdFusion resources here  >>>      
Home /  Groups /  ColdFusion Talk (CF-Talk)

setting div visibility with javascript

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
You shouldn't do.
Craig Dudley
10/10/08 10:31 A
It's complicated:
Scott Stewart
10/10/08 11:04 A
>here's the template:
Peter Boughton
10/10/08 02:45 P
>>here's the template:
Scott Stewart
10/10/08 03:09 P
It's complicated:
Scott Stewart
10/10/08 02:44 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Craig Dudley
10/10/2008 10:31 AM

You shouldn't do. What's going wrong in your example? Hey all, If I'm setting the visibility for a div (display:none or display:block in this case), do also need to set visibility for anything inside the div. IE: <div id="a" style="display:none;">     <span class="whatever">        blah     </span> </div> If I wanted this to not display, and behave properly, do I need to set the display property for the span tag as well? -- Scott Stewart ColdFusion Developer Office of Research Information Systems Research & Economic Development University of North Carolina at Chapel Hill Phone:(919)843-2408 Fax: (919)962-3600 Email: sastew01@email.unc.edu

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Stewart
10/10/2008 11:04 AM

It's complicated: here's the template: http://cfm.pastebin.com/m549bfe76 what I'm specifically dealing with is function Q4Chk(i), which sets display settings based on the input from a set of radio buttons (note: I didn't write this, but I'm trying to get it to work properly) The business logic states that each question in the section has three possible answers, "yes", "no" or "I don't know". "Yes" and "I don't know" should respond exactly the same way, "no" responds differently., However if the user answers "yes", or "I don't know" to any question, that overrides the behavior triggered by any "no" answers. There it is....clear as mud Craig Dudley wrote: ----- Excess quoted text cut - see Original Post for more ----- -- Scott Stewart ColdFusion Developer Office of Research Information Systems Research & Economic Development University of North Carolina at Chapel Hill Phone:(919)843-2408 Fax: (919)962-3600 Email: sastew01@email.unc.edu

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Craig Dudley
10/10/2008 11:19 AM

Umm, it might be as simple as the JS not setting the display property correctly? e.g. document.getElementById("COMMENTB").style.display = "none"; document.getElementById("COMMENTC").style.display = ''; document.getElementById("FRMSUBMIT").style.display = ''; Shouldn't the empty quotes be 'block' ? I could be wrong though. It's complicated: here's the template: http://cfm.pastebin.com/m549bfe76 what I'm specifically dealing with is function Q4Chk(i), which sets display settings based on the input from a set of radio buttons (note: I didn't write this, but I'm trying to get it to work properly) The business logic states that each question in the section has three possible answers, "yes", "no" or "I don't know". "Yes" and "I don't know" should respond exactly the same way, "no" responds differently., However if the user answers "yes", or "I don't know" to any question, that overrides the behavior triggered by any "no" answers. There it is....clear as mud Craig Dudley wrote: ----- Excess quoted text cut - see Original Post for more ----- -- Scott Stewart ColdFusion Developer Office of Research Information Systems Research & Economic Development University of North Carolina at Chapel Hill Phone:(919)843-2408 Fax: (919)962-3600 Email: sastew01@email.unc.edu

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Stewart
10/10/2008 03:12 PM

----- Excess quoted text cut - see Original Post for more ----- style.display = '' effectively removes the diplay setting from the div entirely, it achieves the same effect as display:none. Having said that, somewhere in this mess, the display settings seem to be reversed. It seems that display:none makes the div render, and display:block removes it. This is really getting weirder by the second.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Peter Boughton
10/10/2008 02:45 PM

>here's the template: >http://cfm.pastebin.com/m549bfe76 You really should investigate jQuery. It will allow you to ditch all this ugly overly-verbose code: document.getElementById("COMMENTB").style.display = "none"; document.getElementById("COMMENTC").style.display = "none"; document.getElementById("Q2").style.display = "none"; document.frmQuestions.Unexpected[0].checked = false; document.frmQuestions.Unexpected[1].checked = false; And instead use code that is much easier to understand. For example: $j('#COMMENTB,#COMMENTC,#Q2').hide(); $j(':radio[@name=Unexpected]').attr('checked',false);

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Stewart
10/10/2008 03:09 PM

----- Excess quoted text cut - see Original Post for more ----- unfortunately I don't have time to rebuild in JQuery

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Stewart
10/10/2008 02:44 PM

It's complicated: here's the template: http://cfm.pastebin.com/m549bfe76 What I'm specifically dealing with is function Q4Chk(i), which sets display settings based on the input from a set of radio buttons (note: I didn't write this, but I'm trying to get it to work properly) The business logic states that each question in the section has three possible answers, "yes", "no" or "I don't know". "Yes" and "I don't know" should respond exactly the same way, "no" responds differently., However if the user answers "yes", or "I don't know" to any question, that overrides the behavior triggered by any "no" answers. There it is....clear as mud Craig Dudley wrote: ----- Excess quoted text cut - see Original Post for more ----- -- Scott Stewart ColdFusion Developer Office of Research Information Systems Research & Economic Development University of North Carolina at Chapel Hill Phone:(919)843-2408 Fax: (919)962-3600 Email: sastew01@email.unc.edu


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists