Welcome, Guest
Username: Password: Remember me

TOPIC: Yes, You can do subquestion array filter based on user defined condition

Yes, You can do subquestion array filter based on user defined condition 2 years 2 months ago #84447

I did it :)

Q1 was to ask about rating of services of services and Q2 was to rate ans suggest improvement in services used earlier. Array filtering was not working for me as I wanted to use subquestion about service with higher level of satisfaction. I had zero sense of Jquery and Jscript but worked with scratch while working with my 8 yr old :)

script type='text/javascript'>
$(document).ready(function() {

//Making id's based on subQuestion from previos question
var subCodes = new Array(6);
for (i=0;i < subCodes.length;i++)
subCodes="#java58771X85X1931S"+(i+1);//Q1's codes

//getting values from id and storing index
var indexValue = [ ];

for (i=0;i < subCodes.length;i++){
var valueStored= $(subCodes).val();
if ( (valueStored == "A1") || (valueStored == "A2") )
indexValue.push(subCodes.substr(-2)); //code is S1 thus -2
}

for (i=0;i < indexValue.length;i++){
//$("li#"+"javatbd{SGQ}"+indexValue).remove(); //removed never worked as it gives issues in mandatory
$("li#"+"javatbd{SGQ}"+indexValue).hide();
$("#answer{SGQ}"+indexValue).val("REMOVED");
}
});
</script>

This script is an effort after learning from www.22surveys.com/ and that of www.aptigence.com.au/home/archive website and google :)

Now issues that I faced was that when I declared Q2 as mandatory then I was messed about by code that checks
unfilled fields.

Psating the code for other, if u can, just wanted to share

Wishes,

Limeed for Life
--
[attachment:1]limesurvey_survey_58771.lss[/attachment]
Sleeping near riven trent, UK
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.101 seconds
Donation Image