473,242 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

speeding up response.

Claus Mygind
571 512MB
In an effort to make my apps run faster, I have started to embed a search feature into the html page with javaScript to call and execute an ajax routine. Everything works fine except for setting focus to the first (and only) input element.
Expand|Select|Wrap|Line Numbers
  1. //~~~~~ Display search box ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. function showPopSearch( ) {
  3.     if (  document.getElementById("popSearch").style.visibility == "hidden" ) {
  4.         document.getElementById("popSearch").style.backgroundColor = "#E4BF87";
  5.         document.getElementById("popSearch").style.borderStyle = "ridge";
  6.         document.getElementById("popSearch").style.borderWidth = "5px";
  7.         document.getElementById("popSearch").style.borderColor = "orange";
  8.         document.getElementById("popSearch").style.zIndex = "99";
  9.         document.getElementById("popSearch").style.visibility = "visible";
  10.         document.getElementById("popSearch").style.overflow = "hidden";
  11.  
  12. //to make this brief showGetSearch() is not shown here
  13.         showGetSearch( );
  14.  
  15. //I have to use this timeout or it will run right past the giveSeachFocus( )
  16.         var TimeoutID = setTimeout("giveSearchFocus()", 150);
  17.     }
  18. }
  19.  
  20. //~~~~~ Give Search element focus ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  21. function giveSearchFocus(){
  22.     document.getElementById("SEARCH").select();
  23.     document.getElementById("SEARCH").focus();
  24. }
  25.  
  26.  
The problem is sometimes, the cursor is there instantaneously other times it can take several seconds for it to appear. The users are annoyed that they cannot start typing right away. How can I resolve this issue and always have the cursor appear right away?
Aug 11 '08 #1
11 1662
gits
5,390 Expert Mod 4TB
can you confirm that the field has NO focus or is the focus just 'invisible' ... so you could type instantly ... but just don't notice the focus? this problem seems to be common and i never saw a solution ... but you could 'workaround' it with setting a border around focused fields or a background-color ... so that the focus could be easily noticed ... the cursor alone seems to be a not quite good indicator ... but may be someone has a better solution?

kind regards
Aug 11 '08 #2
Claus Mygind
571 512MB
It is visible, you just cannot type in it until the cursor appears.
Aug 11 '08 #3
gits
5,390 Expert Mod 4TB
then there are some synchronous requests like large js-libs, frames etc.? that might be loaded the same time?
Aug 11 '08 #4
Claus Mygind
571 512MB
when I try this

Expand|Select|Wrap|Line Numbers
  1.  
  2. document.getElementById("SEARCH").style.background-color = "yellow";
  3.  
I get this error.

invalid assignment left-hand side
[Break on this error] document.getElementById("SEARCH").style.background-color = "yellow";\n

But I was able to do this to verify that the cursor was red
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("SEARCH").select();
  2. document.getElementById("SEARCH").focus();
  3. document.getElementById("SEARCH").style.color = "red";
  4.  
Aug 11 '08 #5
gits
5,390 Expert Mod 4TB
it has to be:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("SEARCH").style.backgroundColor 
kind regards
Aug 11 '08 #6
Claus Mygind
571 512MB
Ok I got the back ground color established to check. I can now say that the cursor and color are both delayed.

I have also established that the problem occurs when switching from one type of search request to another. I have several places on each screen where a user can request (click on) a search i.e. they can click on the company Id or company name. The same number of parameters are sent to the search request in either case.

Expand|Select|Wrap|Line Numbers
  1. onmousedown="if (CheckForChange(this.form,'no')) {showPopSearch(event,'Client Id','10','8','client','by Id','id','no','client)};"
  2.  
  3. onmousedown="if (CheckForChange(this.form,'no')) {showPopSearch(event,'Client Name','60','50','client','by Name','Name','no','client)};"
  4.  
As you can see the calls are identical except for the parameters.

On the initial request the popup is instantaneous. But if the user then select a 2nd search request on a different link the delay will occur?

How can I track where the slowdown is occurring. I am using FireFox with Firebug, so I can see response when the page loads but not the execution time of the scripts after the page is loaded, at least I don't know how.
Aug 15 '08 #7
gits
5,390 Expert Mod 4TB
typically there are just two simultanous http-requests allowed ... does the problem occur with two or just more requests? you could either abort the running requests or just don't check every field aqainst the backend through preloading some more data ...
Aug 16 '08 #8
Claus Mygind
571 512MB
There would always be only one request running at the time.
Aug 18 '08 #9
gits
5,390 Expert Mod 4TB
?? how is this ensured ?? you just said that you could search something and simultanously search for another thing ... is it sure that any search is not started before an already started one has returned? does any errors occur in firebug during the requests or response-handlings?
Aug 19 '08 #10
Claus Mygind
571 512MB
Thank you for your kind reply. Sorry for the delayed response, I am not a full time employee so I do not read these posts everyday.

You ask how can I ensure that only one search occurs at the time. Well the search is initiated by the user by clicking on one of several buttons. They are not likely to click on a 2nd button before they have completed the first search. The action of clicking on a button brings up the dialogue box into which the user has to enter the requested search information i.e. enter clients name. Then they click another button on the dialogue box to start the search. This action brings a response to the search dialogue box or responds "no records found". Therefore it is unlikely that they would stop the action of the first search and start a second search.

Besides at this point I am the one testing why the response is slow. And I know that I am only calling on search at the time.

I think you have pointed me to an area to look at, that being what is happening in my code when I change search criteria. So I will continue my search in the code for the answer.
Aug 28 '08 #11
gits
5,390 Expert Mod 4TB
hmmmm ... with a popup it even shouldn't be a problem in case it is a window ... every window handles its own requests (as far as i know) ... when closing it the request should be aborted. so it may be that there is something 'strange' when constructing the request ... in case you find something and need help with it just post back here :)

kind regards
Aug 28 '08 #12

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

Similar topics

4
by: Snyke | last post by:
Hi. I have a command line script which works really fine, the only problem is that it take *really* long for the first output to be printed on screen. Since I also get some HTTP headers I'm...
5
by: joethis | last post by:
I have a query that returns a resultset rather fast, but when I go through the loop to write it out to the page I get a slow display. Is there a way to speed this up?
6
by: Angel Faus | last post by:
Hi all, We've got an Oracle database in a Web application. Intermedia Text queries are an important part of the usage and work fine. The problem is that in order to generate a certain web...
2
by: Robert Wilkens | last post by:
Ok... This may be the wrong forum, but it's the first place I'm trying. I'm new to C# and just implemented the 3-tier Distributed application from Chapter 1 (the first walkthrough) in the...
4
by: Troy | last post by:
Hello all, I was wondering if there is a way to speed up the rendering of a web page to the client browser... In my case, I am retrieving about 60 - 100 rows of data from an SQL Server and I...
0
by: Matt | last post by:
I have a datagrid that gets a SQL query returned containing one column that is XML. While I build the datagrid I have to split and parse the XML to get the information that I want for each row. ...
10
by: Sarah Smith | last post by:
Hello, I am a bit of a newbie to VB.NET, but not totally new. I took the plunge recently and decided (along with my colleagues), to try to convert/port a VB6 client/server app to .Net. (I'm...
2
by: simon_w3 | last post by:
Hi All, I'm trying to figure out how I can speed up a fragment of code (which has been converted from vb6 to .NET) that reads data from a database. My knowledge on database programming is...
5
by: Simon | last post by:
Hi All, I'm trying to figure out how I can speed up a fragment of code (which has been converted from vb6 to .NET) that reads data from a database. My knowledge on database programming is...
3
by: cj2 | last post by:
I can't remember and can't find my notes anywhere. There were a couple of commands that when used with I think the data adapter that allowed for faster reading or writing of tables. I think one...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.