Advertisement
Guest User

Untitled

a guest
Aug 1st, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. <script>
  2. var flag=0;
  3. var SelectConId1='';
  4. function checkAll(cb)
  5. {
  6. flag=0;
  7. SelectConId1='';
  8. var inputElem = document.getElementsByTagName("input");
  9. for(var i=1; i<inputElem.length; i++)
  10. {
  11. if(inputElem[i].id.indexOf("checkedone")!=-1)
  12. {
  13. inputElem[i].checked = cb.checked;
  14. flag=flag+1;
  15. SelectConId1=SelectConId1+inputElem[i].name+',';
  16. }
  17. }
  18. if(cb.checked!=true)
  19. {
  20. SelectConId1="";
  21. flag=0;
  22. }
  23. //alert(SelectConId1);
  24.  
  25. }
  26.  
  27. function checkone(cb,conid)
  28. {
  29.  
  30. var inputElem = document.getElementsByTagName("input");
  31. for(var i=1; i<inputElem.length; i++)
  32. {
  33. if(inputElem[i].id.indexOf("checkedone")!=-1)
  34. {
  35. if(inputElem[i].name!=cb.name && cb.className==inputElem[i].className)
  36. {
  37. inputElem[i].checked=false;
  38. }
  39. }
  40. }
  41.  
  42.  
  43. }
  44.  
  45. function search_element()
  46. {
  47. //alert('hello');
  48. var element=document.getElementById("searchtext").value;
  49. // alert(element);
  50. searchelement(element);
  51. return false;
  52. }
  53. function addtolist()
  54. {
  55.  
  56. if((SelectConId1.length)<=1)
  57. {
  58. alert('Please select at least one Answer Choice');
  59. return false;
  60. }
  61. else
  62. {
  63. addtolistcontact();
  64. }
  65. }
  66.  
  67. function addtolistcontact()
  68. {
  69. }
  70. function closethis()
  71. {
  72.  
  73. }
  74. </script>
  75. <apex:pageBlock >
  76. <apex:pageBlockSection columns="1" collapsible="false">
  77. <apex:repeat var="q" value="{!wrapList}">
  78. <apex:pageBlockSection title="{!q.ques.Title__c}" columns="1" >
  79. <apex:pageBlockTable var="qc" value="{!q.qcList}" id="quesList">
  80. <apex:column >
  81. <input type="checkbox" class="{!q.ques.Id}" name="{!qc.id}" id="checkedone" onclick="return checkone(this,'{!qc.id}')" />
  82. </apex:column>
  83. <div id="{!qc.id}">
  84. <apex:column >
  85. <!--<apex:facet name="header" >Name</apex:facet>-->
  86. {!qc.Title__c}
  87. </apex:column>
  88. </div>
  89. </apex:pageBlockTable>
  90. </apex:pageBlockSection>
  91. </apex:repeat>
  92. </apex:pageBlockSection>
  93. </apex:pageBlock>
  94. </apex:form>
  95.  
  96. public void showRecords(){
  97. //String selectedId = ApexPages.currentPage().getParameters().get('pid');
  98. List<Question__c> quesList = [select id,Title__c,(select id, Name, Title__c from QuestionChoices__r), Name from Question__c ];
  99. for(Question__c q :quesList){
  100.  
  101. List<QuestionChoice__c>qcList = q.QuestionChoices__r;
  102. wrapList.add(new wrap(q,qcList));
  103. }
  104. }
  105.  
  106. public class wrap{
  107. public Question__c ques{get; set;}
  108. public List<QuestionChoice__c> qcList{get; set;}
  109.  
  110. public wrap(Question__c ques, List<QuestionChoice__c> qcList){
  111. this.ques = ques;
  112. this.qcList = qcList;
  113. }
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement