<cfform> submit form.

Discussion in 'Programming' started by vdm, Oct 17, 2007.

  1. #1
    Hi. I have a problem and can't solve it... So I have web page there i can read and delete my messages. Each message has checkbox, if i want to delete messages i select which i want and put submit button. But i don't know how to say to coldfusion <cffile> tag which are selected... Can you help me?
     
    vdm, Oct 17, 2007 IP
  2. vdm

    vdm Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I want to send "i" variable to cffile tag, where is mistake?

    <script type="text/javascript">
    var checkboxes = document.getElementsByName( "ki");
    for (i = 0; i < checkboxes.length; i++) {

    if (checkboxes.checked) {
    window.alert("checked")
    window.alert(i)
    document.write(("<cffile action="delete" file="C:\fd\i.jpg">"));
    }
    }
    </script>
     
    vdm, Oct 19, 2007 IP
  3. cfStarlight

    cfStarlight Peon

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You're mixing apples and oranges :) Javascript executes on the client side (browser) while CF code executes on the server side.

    To run the CFFILE code you need to submit another request to the server. The simplest method is to submit the form. Then on your action page use the form field variables to in combination with <CFFILE> to delete the files.
     
    cfStarlight, Oct 20, 2007 IP