473,989 Members | 2,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

form.submit sometimes does not work!

4 New Member
There are 3 buttons on a web page. On clicking each button a same popup window (say window1) opens up. Now there is another button on this popup window (window1), which further opens up to another popup window (say window2). On selecting some value from the 'window2', that value is passed onto the 'window1'. There is a 'Find' link on a 'window1', which calls a javascript function 'clicked()':

Expand|Select|Wrap|Line Numbers
  1.     <head>
  2.     <%
  3.       Dim command
  4.       command = Request.Form("hid");
  5.       Response.Write(“Value” & command);  -- The value is not printed (Reason found after 
  6.                                                    analysis that may be because the form is not submitted 
  7.                                                     successfully)
  8.     %>
  9.  
  10.     function clicked()
  11.     {
  12.        document.form.hid.value='FIND';
  13.        alert("before");              -- This message box appears
  14.        document.form.submit();  -- after a lot of analysis the conclusion is that 
  15.                                   this submit statement stops working (as on the status   
  16.                                   bar 'Opening https:.....File1.asp?form=...' is not 
  17.                                   displayed when 'after' message box appears
  18.        alert("after");               -- This message box appears 
  19.     }
  20.  
  21.     <body.......>
  22.     <% if command = "FIND" then
  23.        Response.Write ("Inside Find"); -- This message is not printed.
  24.       // some functonality
  25.  
  26.     %>
  27.     <form ....>
  28.  
  29.        <input type="hidden" name="hid" value="">
  30.  
  31.     </form>
  32.     </body>
This full code works fine on my machine. But this code does not work properly when run on the client-side!, although the same server and the same deployed application is being accessed. There is no particular sequence/scenario but for eg.
When say button1 clicked->window1 opens->window2 is opened->value selected->returned to window1->Clicked on Find-> clicked on Ok->returned on the main page.
Then repeated the same scenario for say 3rd button.
(Till now 'Find' link works fine).
Now repeated the same scenario for 2nd button and here 'after' message is obtained but 'inside Find' is not printed!!
Feb 20 '10 #1
5 4741
gits
5,390 Recognized Expert Moderator Expert
hmmm ... i think i don't get it right ... could you rephrase that question so that it would be a bit more clear ... when is what and how passed between different windows? are those windows real popup windows?

kind regards
Feb 26 '10 #2
Curious89
4 New Member
What should happen: On clicking 'Find' link some records are retrieved from the database and displayed on the very same popup window. Now further on clicking 'Ok' the popup window closes and all the retrieved records are populated in a list box on the main page (where there were 3 buttons).

What happens is: The above scenario does happen once or twice but the 3rd or the 4th time what happens is that on clicking 'Find', no records are retrieved and it goes to wait state. It sort of hangs. None of the links work any further, even the ones on the main page stop working. The window2 also doesn't open, blank page is displayed.

In my first post, in the code, i have added the comments of exactly which all alerts/Response.Write are shown and which are not, when the problem occurs.

Yes it seems the browser does not load, the page does not get refreshed. (When the 1st or the 2nd time 'Find' works fine, the page does get refreshed.)
I can't hit anything on the current session anymore!

After a lot of analysis, we have come to this conclusion that probably 'Find' link does not work after sometime because of some memory/buffer issue. I am using a 'for' loop which concatenates the strings retrieved on clicking 'Find' from the database.

Expand|Select|Wrap|Line Numbers
  1. var concatstr = "";
  2. for(i = 0 ; i < arr.length ; i++)
  3. {
  4.      concatstr += arr[i]+";";
  5. }
  6. parent.opener.mainform.txtbx.value=concatstr; // transferring the semicolon separated string to the main form, where there are the 3 buttons 
  7.  
(mainform - is the webpage where there are these 3 buttons.)
(arr - is the array that stores all the retrieved strings from the database on clicking 'Find' link.)

Probably a number of string objects are getting created and filling the buffer. What do u say?
(On an average around 15 strings are retrieved each time)
Probably which is why the 'request' is getting 'blocked'! It goes to wait state.

No other link works as their URL don't work any further (the request is not going through, may be because of the previous pending request [Find link click]), only 'cancel' link works since it has only one statement written : "parent.clo se" (nothing to do with request,respons e).

Is it so that the concatenation described above is creating 15! string objects (read as 15 factorial string objects) and thereby causing the block?
Feb 27 '10 #3
gits
5,390 Recognized Expert Moderator Expert
that small number of string-objects doesn't seem to be an issue that might cause such a problem ... but i cannot see some other obvious thing at the moment. might be to try that all in firefox and have a look at the firebug console might show more info ... i suspect a fatal javascript error that might block the submit then ... it could be a strange return-value that might break the concat-logic or similar ... for example some quotes or double qoutes in the response or something like that?

kind regards
Mar 1 '10 #4
Curious89
4 New Member
@gits
I will definitely try this out, that you have suggested.

Some more information about the code:
We are opening and closing connection on each opening of the popup window. (opening-closing, opening-closing, opening-closing, .....).
Can this be also an overhead?

I am posting some code portions also for your reference :

Expand|Select|Wrap|Line Numbers
  1. // When Ok button is clicked and the popup window closes after concatenating the string names and ids retrieved. After closing the listbox appears on the main page with the string names retrieved.
  2. function clickedOk()
  3. {
  4.    var input1="<select name='myselect' style='width:435;' id='"+btnname+"lboxId' multiple>";         
  5.  
  6.    var input2=new StringBuffer();     
  7.    var concatenated_pooloid = new StringBuffer(); 
  8.    var concatenated_poolnames = new StringBuffer();
  9.  
  10.    for(i=0;i<val.length;i++)
  11.    { 
  12.      input2=input2.append("<option value='"+ (i+1) +"'>"+ val[i] +"</option>");        
  13.      concatenated_pooloid.append(val[i]+";"); 
  14.      concatenated_poolnames.append(val1[i]+";");
  15.    } 
  16.  
  17.     var btn = "clearbutton"+btnname;
  18.     var listbox = btnname+"lboxId";
  19.     var imagebtn = "myIMGOk"+btnname;
  20.  
  21. parent.opener.document.getElementById(names_divID).innerHTML = "";                                     
  22. parent.opener.document.getElementById(names_divID).innerHTML = parent.opener.document.getElementById(names_divID).innerHTML + "&nbsp;&nbsp;<img id='myIMGOk"+btnname+"' style='color: blue; text-decoration: underline; cursor: pointer;font-family: verdana;font-size: 7pt' 
  23. src='/images/ok_arrow.gif' border='0' />" +"&nbsp;<a id='clearbutton"+btnname+"' href=java-script:clearListBox('"+btn+"','"+listbox+"','"+names_divID+"','"+const_IDs+"','"+const_NAMES+"','"+imagebtn+"')><u>Clear</u></a>";
  24.  
  25. parent.opener.document[const_FORMNAME][const_IDs].value = concatenated_pooloid+";";     
  26. parent.opener.document[const_FORMNAME][const_NAMES].value = concatenated_poolnames+";"; 
  27. parent.opener.document.getElementById(names_divID).style.display = "inline";      
  28.  
  29. parent.close();
  30. }
  31.  
  32. function StringBuffer() {  
  33.    this.buffer = [];  
  34.  }  
  35.  
  36.  StringBuffer.prototype.append = function append(string) {  
  37.    this.buffer.push(string);  
  38.    return this;  
  39.  };  
  40.  
  41.  StringBuffer.prototype.toString = function toString() {  
  42.    return this.buffer.join("");  
  43.  };  
  44.  
  45.  function validateAndSubmit() {            
  46.                 document.resourcePickerForm.hidCommand.value =  "FIND";
  47.                 document.resourcePickerForm.action =  "popupWnd.asp?............";   // ....... means parameters
  48.                 document.resourcePickerForm.submit();
  49.     }
  50.  
  51. <script type="text/java-script">
  52.  
  53.     // Global Variable Declaration
  54.     var countTextBox = 0;
  55.     var tempcount = 0;
  56.     var totalSelected = 0;
  57.  
  58.     var selectedArray = new Array();
  59.     var selectedArray1 = new Array();
  60.     var count=0;
  61.     var val = new Array();
  62.     var val1 = new Array();
  63.  
  64.     var const_FORMNAME='<%=(Request.QueryString("FormName"))%>';
  65.  
  66.  
  67. // This is called after checking the checkboxes displayed with retrieved strings and transferring them on the right-side of the page, the ones which we want to pass on the main page (displayed inside the listbox).
  68. function transfer()
  69. {         
  70.    // Finding which checkboxes are checked and then adding them.
  71.    var i=0;  
  72.    while(document.getElementById("chkbox"+i))
  73.    {   
  74.     if(document.getElementById("chkbox"+i))
  75.     {    
  76.        if (document.getElementById("chkbox"+i).checked)
  77.        {  
  78.                 var inputTag = document.createElement ("input");
  79.                 var type = "text";
  80.                 inputTag.setAttribute("text",type);
  81.                 inputTag.setAttribute("value",selectedArray[i]);             
  82.                 inputTag.setAttribute("name",type+count);
  83.                 inputTag.setAttribute("size",45);
  84.                 inputTag.setAttribute("font-size",8);        
  85.                 inputTag.setAttribute("id","strText"+count);
  86.                 val[count]=selectedArray[i];   // Filling names  into array val                                 
  87.                 val1[count]=selectedArray1[i]; // Filling ids  into array val1                    
  88.  
  89.                 document.getElementById('RightFrame').innerHTML  = document.getElementById('RightFrame').innerHTML + "<br  id='br"+count+"'>&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox'  id='RFchkbox" + count + "' name='RFchkbox" + count + "'  visible='true' />&nbsp;<input type='text'  style='font-size:10;font-family:Verdana;' id='strText"+count+"'  value='"+selectedArray[i]+"' size='50' readonly='readonly'/>"    
  90.  
  91.                   count++;
  92.               }                                     
  93.         document.getElementById("chkbox"+i).checked="";
  94.         }            
  95.      }
  96.      i++;      
  97.      document.getElementById("C1").checked="";            
  98.    }
  99. }
  100.  
  101. </script>
  102.  
  103.  
  104.     <%
  105.         Dim command         
  106.         command = Request.Form("hidCommand")                
  107.     %>
  108.  
  109.     <%
  110.       Sub ChildDisplay(poolOID)
  111.  
  112.       Set LocalRS = Server.CreateObject("ADODB.RecordSet")
  113.       strSQL="select name,id,..................."
  114.  
  115.       LocalRS.Open strSQL, Conn
  116.  
  117.       If Not LocalRS.EOF Then
  118.  
  119.          LocalRS.MoveFirst 
  120.          j = 0 
  121.     %>
  122.     <%
  123.             Do While LocalRS.EOF <> True
  124.     %>
  125.     <tr>
  126.         <td width="2%" style="border:solid 1px  #6c9fc6;border-top:0;">
  127.             <font size="1" face="Verdana">
  128.                 <input type="checkbox" id="chkbox<%= j %>"  name="C2" value="<% = LocalRS.Fields(0).value %>"  on-cl-ick='java-script:setSelected("<%=LocalRS.Fields(0).val ue %>", "<% = LocalRS.Fields(2).value %>","<%= j %>")'></font>
  129.                 <input type="hidden" id="PoolId<%= j %>"  value="<% = LocalRS.Fields(2).value %>" />
  130.          </td>
  131.         <td width="50%" style="border:solid 1px  #6c9fc6;border-top:0;border-left:0;" >
  132.             <font face="Verdana" size="1">
  133.                 <% = LocalRS.Fields(0).value %>
  134.             </font>
  135.         </td>  
  136.      </tr>
  137.     <%
  138.     j = j + 1
  139.                   LocalRS.MoveNext
  140.                   If LocalRS.EOF = True then 
  141.                         exit do     
  142.                   end if
  143.             loop
  144.       %>
  145.     <%
  146.       end if
  147.       LocalRS.Close     
  148.       Set LocalRS=nothing                                   
  149. End Sub
  150.     %>
  151.  
  152. <body style="background-color: #fcfefd">
  153.     <!-- #include virtual="/config/DataSource.asp"  -->
  154.     <% if command = "FIND" then 
  155.     %>
  156.     <%
  157.       Dim Conn          ' Connection Variable
  158.       Dim RS             ' Result Set Variable
  159.       Dim strSQL       ' SQL Query String
  160.  
  161.       Set Conn = Server.CreateObject("ADODB.Connection")
  162.       Set RS = Server.CreateObject("ADODB.RecordSet")
  163.  
  164.       locName = Request.Form("location") 
  165.       strSQL = "select name, id from table1 where location ='"+locName+"'"
  166.  
  167.       Conn.Open  SSdsn, SSdbuser, SSdbpass
  168.  
  169.       RS.Open strSQL, Conn    
  170.  
  171.       If Not RS.EOF Then
  172.             RS.MoveFirst
  173.       End If                 
  174.     %>
  175.     <% end if %>
  176.  
  177.     <form name="popupWndForm" action="" method="post">
  178.  
  179.         <input type="hidden" id="hidCommand" name="hidCommand"  value="" />
  180.         <a href="java-script:transfer()">Transfer</a>  
  181.         <a  href="java-script:validateAndSubmit()">Find</a>
  182.         <a href="java-script:clickedOk()">OK</a>  
  183.  
  184.          <div class="leftframe">
  185.             <% if command = "FIND" then            
  186.             %>
  187.  
  188.             <table id="table1" height="30" cellspacing="0">
  189.                 <!-- MSTableType="nolayout" -->
  190.                 <tr>
  191.                     <td bgcolor="#c2d6e7" style="border:solid  1px #6c9fc6;">
  192.                         <input type="checkbox" name="C1"  value="yes" on-cl-ick="java-script:selectDeselectAll()"></td>
  193.                     <td bgcolor="#c2d6e7" style="border:solid  1px #6c9fc6; border-left:0">
  194.                         <b><font face="Verdana" size="1">Name</font></b></td>                                       
  195.                 </tr>
  196.                 <%
  197.                       ChildDisplay(RS.Fields(2))      
  198.                 %>
  199.             </table>
  200.  
  201.             <% end if %>
  202.           </div>  
  203.    </form>
  204.  
  205.     <% if command = "FIND" then 
  206.     %>
  207.     <%
  208.       RS.Close    
  209.       Conn.Close        
  210.       Set RS=nothing
  211.       Set Conn=nothing
  212.     %>
  213.     <% end if %>
  214.  
  215. </body>
  216. </html>
  217.  
Thanks in advance.
Mar 2 '10 #5
Curious89
4 New Member
The problem is similar to one that is mentioned here:
[url=http://www.justskins.c om/forums/browser-hangs-when-posting-sometimes-85959.html]

"If we close the IE window, and start open a new one, then things start loading again. And this is pretty much the only way to get to the web site after this happens, is to restart IE. Any attempts in the original IE window hang."
Mar 2 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
609
by: Kevin Ingram | last post by:
Ok, this is probably a silly question but I just keep hitting a brick wall here. I usually develop my sites entirely in ASP and use a database for data storage, works great for me. I also sometimes save information to a text file on my server like c:\invoices\customername.txt for batch processing later... I use the FSO commands and it all works slick. Now, I have a new project: A client wants us to log in to their website on another...
2
7057
by: Andy Goldstein | last post by:
I have a table where all the TRs have an onClick handler registered. One (and only one) of the rows has 2 text input boxes, where each textbox has an onChange handler registered. Both the onClick and onChange handlers do some minor manipulation of form data (although they work on different form elements). If the onChange event fires, I need the form to be submitted. If the onClick event fires for a TR, I also need the form to be...
6
18840
by: HD | last post by:
Hi. I have an asp page with radio buttons and a combobox... when the user clicks a radio button, I want the form to submit so I can execute the ASP code in order to change the list shown in the combobox... I have 2 radiobuttons: <input type="radio" name="terriprod" value="E">E <input type="radio" name="terriprod" value="D">D I have tried adding an OnClick event to each of the radio button...
14
6938
by: threeflush | last post by:
I'm supporting an ASP legacy application and need to implement "autosave" functionality. I have two frames, one that holds tabs displaying different pages a user can select, and the other that holds the page content itself. If a user clicks on another tab without clicking the Submit button, I want to submit the current form for them and do some further processing. The problem is that top.framename.formname.submit() only works...
4
7614
by: Peloux | last post by:
Hi, I have written some htc in order to validate data in a form. most of htc are attached on 'onblur' event. Now, we would like to use the Enter Key to sublit form, so we use the following code : ----------- <SCRIPT> function touche_EnterKeyPress(){
1
2591
by: Piotr Kurpiel | last post by:
Hi, I am creating a site where I need to refer to another external file (aspx). I create the form and works fine. But as soon as I try to submit the form automatically (with form.submit()) I get an error from the external site. I do not have the code of that site but suppose that my automatic submission does not pass all of the variables. This is how it looks in plain html: <form name="Login" method="post"
5
17728
by: Navillus | last post by:
Hey gang, I have a login form that is empty by default, but can be filled with values from a previous form: <input type=text maxlength="40" size="40" name="user" value="`usr`"> <input type=password maxlength="8" name="password" value="`pss`"> where usr and pss are sent from the previous form.
1
10856
by: gbezas | last post by:
Hi All, I have added an event handler to redirect form.submit() to a newSubmit() method that I have defined (which does some additional processing before submitting the form). Additionally I have defined the relavant function method in the code for details) The issue is that when Icall targetForm._submit() method from the newSubmit() function the page I get an 'Object doesn't support this property or method' error I am using IE...
3
4963
by: annoula | last post by:
Hello, I'm sorry if this has come up before but I haven't been able to find a solution in any forum so far. I have a page with 2 forms. One form contains links that the user clicks to navigate to pages.The other form is the main component of the page. It has radiobuttons and textfields for the user to select/enter input. The links have actions that I want to fire if the javascrict that I have in the 'onclick' validates. If it doesn't...
2
4791
by: rudiedirkx | last post by:
Gents, I have a problem (only in Safari) with the onsubmit in webforms. This topic covers the same subject: http://bytes.com/topic/javascript/answers/166542-onsubmit-safari but not as detailed as I will. Let me illustrate the problem with examples. The HTML: <html> <head> <script type="text/javascript" src="/js/mootools_1_11.js"></script>
0
10403
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11918
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11490
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11710
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6660
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.