Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8583395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:31:39+00:00 2026-06-11T21:31:39+00:00

I have a form with a variable number of text boxes that contain an

  • 0

I have a form with a variable number of text boxes that contain an id. When the user exits the page, files on the server are deleted by a python script (delete.py). The filename of the files to delete contains the id so the id has to be passed to the python script. If my form has a single id, everything works perfectly and the file on the server is deleted. If my form has multiple id fields, no files get deleted. If I use firebug to step through the code, the files gets deleted regardless of the number of id fields. I don’t understand what is going on. Any help would be greatly appreciated. My onbeforeunload method is below.

function deleteFiles()
  {
  var xmlhttp;

  if (window.XMLHttpRequest)
  {
    xmlhttp=new XMLHttpRequest();
  }
  else
  {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }  

  allElements = document.getElementsByName("id");
  for (x=0; x < allElements.length; x++)
  {
    xmlhttp.open("GET","/cgi-bin/delete.py?id=" + allElements[x].value,true);
    xmlhttp.send();
   }  

window.onbeforeunload = deleteFiles;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:31:40+00:00Added an answer on June 11, 2026 at 9:31 pm

    Sounds like the request’s are being sent too fast. Try adding

    xmlhttp.async = false;

    function deleteFiles()
      {
      var xmlhttp;
    
      if (window.XMLHttpRequest)
      {
        xmlhttp=new XMLHttpRequest();
    
      }
      else
      {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }  
    
      allElements = document.getElementsByName("id");
    
      xmlhttp.async = false;
    
      for (x=0; x < allElements.length; x++)
      {
        xmlhttp.open("GET","/cgi-bin/delete.py?id=" + allElements[x].value,true);
    
        xmlhttp.send();
       }  
    
    window.onbeforeunload = deleteFiles;
    

    Let me know your findings

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that has 8 columns and a variable number of rows
I have a form that allows a user to add an unlimited number of
I have a variable number of fields in a form. The number of text
Greetings, I have a form with a variable number of inputs, a simplified version
I have some variable where everytime the form is submiited or page is refreshed,
I have a variable that contains an array from form data, seen below: $option1
I have a line of text in the form some spaces variable = 7
I have a search form that has different elements in it, checkboxes, selects, text
I have a project that merges in one form field two variables. Number of
I have a simple html text box. When I submit the form that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.