[Javascript] Re:posting arrays

Bill Marriott bill.marriott at optusnet.com.au
Thu Oct 4 22:27:41 CDT 2001


RE: [Javascript] Re: anchors - passing valuesHi Everyone,

Thanks for your help in the past.

I have a new problem with posting arrays.

I want to use an array 

var linksToDelete = new Array();

to store the ID's of records to delete from the database.

I have got the javascript (see below) to add the elements to the array as the user deletes a record from the page.

How can I post the array(with all the elements) to the next page in order to do the processing for the deletes. The <input hidden tag> dosen't want to post the array!



<SCRIPT LANGUAGE=Javascript>
var ns = (navigator.appName.indexOf('Netscape')>-1);
var ie = (navigator.appName.indexOf('Microsoft Internet Explorer')>-1);

var linkCount = <?MIVAR>$LINKCOUNT<?/MIVAR>;
var linksToDelete = new Array();
var deleteCount = 0;

function removeRow(e) 
{
if (confirm("Do you want to delete this row?")) 
   {
 if (ns) 
 {
  var srcElement = e.target;
 }
 else
 {
  var srcElement = event.srcElement;
 }
 if (srcElement.nodeType == 3)
 {
  srcElement = srcElement.parentNode;
 }
 var delRow = srcElement.parentNode.parentNode;
 var tBodyObj = document.getElementById("linkTBody");
        linksToDelete[deleteCount] = delRow.id;
        alert(linksToDelete[deleteCount]);  ////this works here
        document.editTable.LINKSTODELETE[deleteCount].value=delRow.id; ////       THIS LINE IS NOT WORKING
        deleteCount++; 
        tBodyObj.removeChild(delRow);
        linkCount--;
        document.editTable.LINKCOUNT.value=linkCount; ////single input hidden tag in the form
        document.editTable.DELETELINKCOUNT.value=deleteCount; //// single input hidden tag in the form
   }
else 
   {
    ////cancel;
   }   
}
</SCRIPT>

<INPUT TYPE="hidden" name="LINKCOUNT" Value="<?MIVAR>$LINKCOUNT<?/MIVAR>"> 
<INPUT TYPE="hidden" name="LINKSTODELETE[]" >
<INPUT TYPE="hidden" name="DELETELINKCOUNT" Value="0">


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20011005/29f5015d/attachment.htm>


More information about the Javascript mailing list