Solved

Hidden division changed to Show when page reloaded

Posted on 2011-09-26
2
167 Views
Last Modified: 2012-05-12
I'm using this script to toggle the visibility on my page.

 
<script type="text/javascript">
	function toggleq6(evt) {
	evt = (evt) ? evt : event;
	var target = (evt.target) ? evt.target : evt.srcElement;
	var block = document.getElementById("q6Data");
	if (target.id == "q5Flag1") {
		block.style.display = "block";
	} else {
		block.style.display = "none";  
	}
		
	}
</script>

Open in new window


and this is the section it toggles:

 
<li>Did you utilize <b>past performance</b> or <b>other PDO writing</b> services on this proposal?  
<div>
<input type="radio" name="q5" id="q5Flag1" value="1" onclick="toggleq6(event)" <cfif url.q5 EQ 1>checked</cfif>> Yes 
<input type="radio" name="q5" id="q5Flag0"value="0" onclick="toggleq6(event)" <cfif url.q5 EQ 0>checked</cfif>> No</div>
</li>
</ol>
<div id="q6Data" style="display:none; margin: 0 0 15px 0px">
<ol start="6">
<li>How would you rate your <b>overall experience</b> with <b>PDO's past performance or other writing services</b><br />on this proposal? <br />
<table cellpadding="0" cellspacing="0" class="noborder surveyQuestion">
	<tr>
    	<td><input type="radio" name="q6" value="-5" <cfif url.q6 EQ "-5">checked</cfif>/>-5&nbsp;</td>
    	<td><input type="radio" name="q6" value="-4" <cfif url.q6 EQ "-4">checked</cfif>/>-4&nbsp; </td>
    	<td><input type="radio" name="q6" value="-3" <cfif url.q6 EQ "-3">checked</cfif>/>-3&nbsp;</td>
    	<td><input type="radio" name="q6" value="-2" <cfif url.q6 EQ "-2">checked</cfif>/>-2&nbsp;</td>
    	<td><input type="radio" name="q6" value="-1" <cfif url.q6 EQ "-1">checked</cfif>/>-1&nbsp;</td>
    	<td><input type="radio" name="q6" value="0" <cfif url.q6 EQ "0">checked</cfif>/>0&nbsp;</td>       
    	<td><input type="radio" name="q6" value="+1" <cfif url.q6 EQ "+1">checked</cfif>/>+1&nbsp;</td>
    	<td><input type="radio" name="q6" value="+2" <cfif url.q6 EQ "+2">checked</cfif>/>+2&nbsp;</td>
    	<td><input type="radio" name="q6" value="+3" <cfif url.q6 EQ "+3">checked</cfif>/>+3&nbsp;</td>
    	<td><input type="radio" name="q6" value="+4" <cfif url.q6 EQ "+4">checked</cfif>/>+4&nbsp;</td>
    	<td><input type="radio" name="q6" value="+5" <cfif url.q6  EQ "+5">checked</cfif>/>+5&nbsp;</td>
    </tr>

Open in new window

...

When the user is returned to the page having selected yes to the toggle how can I have Q6 automatically showing?

I hope this makes sense!
0
Comment
Question by:traport
2 Comments
 
LVL 13

Accepted Solution

by:
ansudhindra earned 500 total points
ID: 36599837
try like this...

<cfif isdefined('form.q6') and trim(form.q6) neq "">
       <div id="q6Data" style="display:block; margin: 0 0 15px 0px">
<cfelse>
       <div id="q6Data" style="display:none; margin: 0 0 15px 0px">
</cfif>

where "form.q6" -  if the form is submitted to istself and showing it to user
or replace with the proper variable name if you are loading the values from database..

Br-Sudhindra-www.clicksperday.com
0
 

Author Closing Comment

by:traport
ID: 36600255
Thanks so much!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now