Hi,
I have a problem....
When my special question is hidden it won't write value to database.
A good way to test this is to:
1. Create special question and its conditional on another question. So you can hide/unhide it within the same page.
2. Set a value in this special question
3. Hide it
4. Click next or submit.
5. Check responses, hay no entry!!
The value doesn't get cleared either when you hide and unhide question
so it has to do with the submit form part to LimeSurvey.
I also tried forcing it to display just before the submit form is run but that didn't work either.
i.e. document.getElementById('question302'

.style.display='';
document.getElementById('display302'

.value='on';
I've attached as a txt file and pasted it.
Here's my code :
Question 01
<div id="LS_Timer" style="padding-right: 3px; padding-left: 3px; left: 25px; padding-bottom: 3px; padding-top: 3px; position: absolute; top: -25px; background-color: lime"> </div>
<script type="text/javascript">
/***********************************************
* Darts Timer Question
* 23/Sept/2008
***********************************************/
var timecount = 0; // in seconds
function countup(){
timecount++;
var secs = timecount % 60; if (secs < 10) secs = '0'+secs;
var T1 = (timecount - secs) / 60;
var mins = T1 % 60; if (mins < 10) mins = '0'+mins;
var hours = (T1 - mins) / 60; if (hours < 10) hours = '0'+hours;
document.getElementById("LS_Timer"

.innerHTML = hours + ':' + mins +':'+ secs;
if (timecount>0) setTimeout("countup()",1000);
}
function doSomething(e) {
if (!e) var e = window.event;
// alert('Event Captured :'+e.type); //Un-comment to see what event was called
if (e.type=='submit'

{
// if ((document.getElementById('java76988X43X297'

.value))
//Prehaps enable my question to see if it will write to database
document.getElementById('question302'

.style.display='';
document.getElementById('display302'

.value='on';
//Write timer value to hidden form label
document.getElementById('answer76988X43X302'

.value=timecount;
}
}
function addEvent( obj, type, fn ) {
if ( obj.attachEvent ) {
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
obj.attachEvent( 'on'+type, obj[type+fn] );
} else
obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
if ( obj.detachEvent ) {
obj.detachEvent( 'on'+type, obj[type+fn] );
obj[type+fn] = null;
} else
obj.removeEventListener( type, fn, false );
}
/***********************************************
* Dock Content script- Created by and © Dynamicdrive.com
* This notice must stay intact for use
* Visit
www.dynamicdrive.com/ for full script
***********************************************/
var offsetfromedge=0 //offset from window edge when content is "docked". Change if desired.
var dockarray=new Array() //array to cache dockit instances
var dkclear=new Array() //array to cache corresponding clearinterval pointers
function dockit(el, duration){
this.source=document.all? document.all[el] : document.getElementById(el);
this.source.height=this.source.offsetHeight;
this.docheight=truebody().clientHeight;
this.duration=duration;
this.pagetop=0;
this.elementoffset=this.getOffsetY();
dockarray[dockarray.length]=this;
var pointer=eval(dockarray.length-1);
var dynexpress='dkclear['+pointer+']=setInterval("dockornot(dockarray['+pointer+'])",100);';
dynexpress=(this.duration>0)? dynexpress+'setTimeout("clearInterval(dkclear['+pointer+']); dockarray['+pointer+'].source.style.top=0", duration*1000)' : dynexpress;
eval(dynexpress);
}
dockit.prototype.getOffsetY=function(){
var totaloffset=parseInt(this.source.offsetTop);
var parentEl=this.source.offsetParent;
while (parentEl!=null){
totaloffset+=parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}
function dockornot(obj){
obj.pagetop=truebody().scrollTop;
if (obj.pagetop>obj.elementoffset) //detect upper offset
obj.source.style.top=obj.pagetop-obj.elementoffset+offsetfromedge+"px";
else if (obj.pagetop+obj.docheight<obj.elementoffset+parseInt(obj.source.height)) //lower offset
obj.source.style.top=obj.pagetop+obj.docheight-obj.source.height-obj.elementoffset-offsetfromedge+"px";
else
obj.source.style.top=0;
}
function truebody(){
return (document.compatMode && document.compatMode!="BackCompat"

? document.documentElement : document.body
}
var dock0=new dockit("LS_Timer", 0);
countup();
//Capture events for submit and click
addEvent(document.getElementById('limesurvey'

,"submit",doSomething); //this happens when Next button is clicked
addEvent(document.getElementById('limesurvey'

,"click",doSomething); //Any mouse click events
</script>