If you are unable to create a new account, please email support@bspsoftware.com

 

Limit the check box prompt values with check box prompt ( without finish button)

Started by umareddy0706, 07 Jul 2014 07:12:09 AM

Previous topic - Next topic

umareddy0706

Hello Everyone,
I have created java script to limit the check box prompt values with java script, it is working fine.

HTML tag1:

<div id="p_Dealsize">

HTML Tag 2:

</div>
<script language="javascript" type="text/javascript">
function CountSelected()
{   var Counter = 0;
   var i;
   var eleTg1 = document.getElementById("selectPicklist");
   var SelectObject = eleTg1.getElementsByTagName("input");
   for ( i = 0; i < SelectObject.length; i++)
   {   var node = SelectObject;
      if (node.checked)
      {   Counter++;   }   }   
   if (Counter < 11)
   {   promptAction('finish');     }
   else
   {   alert('The number of selected items is too high, it should be 10 or less, you currently have ' + Counter + ' items selected.  Please remove some items then click on Finish again.');}   }
</script>



3. HTML tag 3 (finish button):

<div class="clsPromptComponent" pt="btn"><button type="button" name="FinishButton" id="finishButton" class="bp" onmouseover="" onmouseout="" onclick="CountSelected()" style="">Finish </button></div><script></script>


My question is :

I have multiple mandatory prompts along with above prompt, but for those mandatory prompts I am not applying any above script.  I am applying above java script for one of the prompt ( deal size). so that I have to create 2 finish buttons. then end user will confuse so that I have to remove one of the finish button.

Can I write the above java script with same functionality without writing the finish button script..

Please help me.

Thanks in advance.

Regards
Mahesh

rprameshwor

Hello ,

I'm not sure why deleting the default finish button and replacing the custom HTML finish button is a problem . After there is just 1 button, there is no way any user will get confused.

'm not sure on this , but try attaching onClick listener to the checkbox.  something like checkboxElement.onclick=counter();

so, every time any item is selected/unselected , the counter is called and the count is updated,  and error displayed when counter is more than 10.