Solved

Hidden division changed to Show when page reloaded

Posted on 2011-09-26
2
168 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

943 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

10 Experts available now in Live!

Get 1:1 Help Now