vithyananthy
Mon Jul 30 03:57:11 CDT 2007
On Jul 30, 1:39 pm, vithyanan...@gmail.com wrote:
> On Jul 28, 9:59 am, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
>
>
>
>
>
> > [vithyanan...@gmail.com] wrote-:
>
> > > Thnx. Client's requirement is to have a check box as to delete and all
> > > they could do so by selecting multiple records.
>
> > OK. Then loop through all the checkboxes and check if more than 1 is checked, e.g.:
>
> > var chks=document.getElementsByTagName("INPUT"),iX=0,curr,count=0;
> > while(curr=chks[iX++])
> > if(curr.type=="checkbox" && curr.checked)
> > count++;
> > if(count>1)alert('Please select only 1 record.')
> > return 0
>
> > Good Luck, Ayush.
> > --
> > Scripting Solutions Center :
http://snipurl.com/Scripting_Solutions
>
> Hi Ayush,
>
> Thnx.
>
> I have put your code in my source as below
> <script type ="text/javascript" >
> var
> chks=document.getElementsByTagName("INPUT"),iX=0,curr,count=0;
> while(curr=chks[iX++])
> if(curr.type=="checkbox" && curr.checked)
> count++;
> if(count>1)alert('Please select only 1 record.')
> return 0
> </script>
>
> But, nothing happens what i did wrong?
>
> I have a script like the below
>
> <script type ="text/javascript" >
> function ValSelectedRows(e) {
> var targ;
>
> if (!e) var e = window.event;
> targ = (e.target) ? e.target : e.srcElement;
> if (targ.nodeType == 3) targ = targ.parentNode;
>
> if (targ.id.toLowerCase().indexOf("img") >= 0) {
> return confirm("Please select only one row to continue.");
> }
> routeEvent(e);
>
> }
>
> document.onclick = ValSelectedRows;
> </script>
>
> Above is working, but the problem is, when ever i clicked on the edit
> button, regardless of the no. of records selected, it is always popped.- Hide quoted text -
>
> - Show quoted text -
Hi Ayush,
I coded like the below then it is working
<script type ="text/javascript" >
function ValSelectedRows(e) {
var
chks=document.getElementsByTagName("INPUT"),iX=0,curr,count=0;
while(curr=chks[iX++])
if(curr.type=="checkbox" && curr.checked)
count++;
if(count>1) alert('Please select only 1 record.')
return 0
var targ;
if (!e) var e = window.event;
targ = (e.target) ? e.target : e.srcElement;
if (targ.nodeType == 3) targ = targ.parentNode;
if (targ.id.toLowerCase().indexOf("img") >= 0) {
return confirm("Please select only one row to continue.");
}
routeEvent(e);
}
document.onclick = ValSelectedRows;
</script>
But, I can click on the edit button when multiple items are selected.
Can I control this behaviour?