I started doing with
<td align="center">
<html:checkbox name="selectedItems" property="id">
<bean:write name="book" property="ISBN" /><br>
</html:checkbox>
</td>
But I am kinda stuck as to how to retrieve the aray of selected Checkboxes
Help aprpeciate
dThanks
as as <[EMAIL PROTECTED]> wrote:
Hi,
I am basically writing a shopping cart application where I would display books
collection as a table row with chekcboxagainst it and let user check a box for
deletion.I aneed to capture the deleted items lis as an array (wrote a javascript
function for this but as struts code gets generated on the sever, the client side
javascript code for deletion fails(saying form.checkboxes.length is null)
Any tips on alternate strategies to implement the same....
Thanks in advance,
Sam.
(probably ted husted's idea of DispatchAction to get array of selectedItems...but i
couldnt succeed in implemneting this due to hurdles...)
My code below...
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}
function set(target) {document.forms[0].dispatch.value=target;}
[input]
value="return getCheckedItems();">
[input]
[input]
Book name
ISBN
[input] ">
function getCheckedItems()
{
var value = false;
menus = new Array;
var msg = "";
var checkBoxes = document.forms[0].elements["list"];
for(var i = 0; i
{
if(checkBoxes[i].checked)
{
menus = menus+","+i;
value = true;
}
}
menusChopped = menus.substr(1,menus.length-1);//chop leading comma
deleteArray = new Array;
deleteArray = menusChopped.split(",");
finalDeleteArray = new Array;
for (i=0;i
finalDeleteArray[i]= deleteArray[i];
alert(finalDeleteArray[i]);
}
if(!value)
alert("Check at least one of the checkboxes, thanks.");
//this.form.action="http://myserver.com/searchById/submit.do";//fix this
//window.location.href='deleteBook.do';
return finalDeleteArray;
}
---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster.
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!