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

4 years 7 months ago #84447 by unasir
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

This script is an effort after learning from and that of 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


Limeed for Life
Sleeping near riven trent, UK

Please Log in to join the conversation.