4 Replies Latest reply on Jul 4, 2006 9:59 PM by coderWil

    delete func

    emmim44 Level 1
      I dont know why my del function dont work...Any help wll b app...
      ------------------------------------------------
      <cfparam name="url.action" default="">
      <cfparam name="Form.Imgs" default="">
      <cfparam name="Form.rpt" default="">
      <cfif #form.rpt# eq "" And #form.imgs# eq "">***Please select at least one check box***<cfabort></cfif>
      <!---
      <cffile action="copy" source="\\btridssc\CAD-Archive\ARCHIVAL\RASTER\PKS001\RI-1\P008A001.TIF" destination="C:\F">--->

      <table width="800" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td width="213"></td>
      <td width="213"></td>
      <td width="232"> <input name="search" type="image" src="imgs/zipicon.gif" alt="{ Select drawings.Then Zip and download them }" width="33" height="33" border="0" onClick=""></td>
      <td width="278"> <input name="s" type="image" src="imgs/file.gif" alt="{ Click to Create Report }" width="28" height="28" border="0"></td>
      </tr>

      <cfloop list="#Form.imgs#" index="i" delimiters="," >

      <!---Extract loc from="1" to="#listlen(form.imgs)#"--->
      <cfset L1=#listgetat(i,1,'|')#>
      <!---Extract Img Name--->
      <cfset L2=#listgetat(i,2,'|')#>
      <!---DocID--->
      <cfset L3=#listgetat(i,3,'|')#>
      <!---Ctr No--->
      <cfset L4=#listgetat(i,4,'|')#>

      <cfform name="myform" method="post" action="zip_liveA.cfm?action=download" >

      <tr>
      <td width="77"><input name="chk" type="checkbox" value="#L1#|#L2#|#L3#|#L4#"> <cfoutput>#L2#</cfoutput>   <img src="imgs/del.gif" alt="Remove" width="15" height="15" border="0" onClick="del(form.imgs,#i#)" >

      </td>


      </tr>

      </table>
      </cfform>
      </cfloop>


      <cfscript>
      function del(a,n)
      {
      listdeleteat(arguments.a,arguments.n);
      //CFLOCATION(theURL:"zip_liveA.cfm");
      GetPageContext().getResponse().sendRedirect('zip_liveA.cfm');
      //CFOUTPUT("Your UserName is Wrong.. try again!");
      }
      </cfscript>
        • 1. delete func
          mike.short
          Removed by author
          • 2. delete func
            mike.short Level 1
            You didn't say in what way it wasn't working. If I were to guess, though, I would speculate that you have forgotten that when you do a listdeleteat for element n, the nth element goes away, and the n+1th element becomes the new nth element. For example, let's say you delete the second element from 1,2,3. The list then becomes 1,3 ... and '3' is the 2nd element. Does this help?
            • 3. Re: delete func
              emmim44 Level 1
              someone else said I need AJAX,,,The usage of function is wrong..all code must be exec by cf server...
              • 4. Re: delete func
                coderWil
                Please post the error that you are receiving.

                At first glance it appears that you are calling a client-side script that you built with a serverside script language. <cfscript> is only usable by the .cfm page before the page is sent to the server. Any call to del() on the client side will look for clientside script like Javascript\\

                Hope this helps