Removing the "you've already answered" and just show the results

Forums SPJS Poll Removing the "you've already answered" and just show the results

Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • #18491
      Alastair Roome
      Participant

      Love this poll solution. It works great but I needed the results to show once you’ve answered the question rather than show the text and then have to click to the results. I’ve tried looking through the code but can’t seem to get the results to show. Any help would be gratefully received.

    • #18536
      Alexander Bautz
      Keymaster

      It’s been a while since I looked at this one and I don’t have it set up to test. I think you should be able to change the line with “spjs.poll.results(argObj.id)” to make it go directly to the result. I have commented out one line, and added another.

      if(active){			
      		if(argObj.singleResponse){
      			query = "<Where><And><Eq><FieldRef Name='Title' /><Value Type='Text'>"+argObj.id+"</Value></Eq><Eq><FieldRef Name='Author' LookupId='TRUE' /><Value Type='Integer'>"+userId+"</Value></Eq></And></Where>";
      			res = spjs_QueryItems({listName:argObj.pollAnswerListName,listBaseUrl:argObj.listBaseUrl,query:query,viewFields:['ID','Answer']});
      			if(res.count>0){
      				// $("#poll_a_"+argObj.id).html("<div style='font-size:9px;padding-top:10px'>"+spjs.poll.text.alreadyRespondedText+res.items[0].Answer+"</div>");
      				spjs.poll.results(argObj.id);
      				$("#poll_btn_submit_"+argObj.id).remove();
      				return;
      			}
      		}
      		$("#poll_a_"+argObj.id).html(aBuffer.join('<br />'));
      	}else{
      		$("#poll_a_"+argObj.id).html(notActiveMsg);	
      	}
      },
      "results":function(id){

      Alexander

Viewing 1 reply thread
  • You must be logged in to reply to this topic.