473,805 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically Refreshing a DIV or other control from the Server

I've been searching, but apparently not phrasing my search right, so I'm
going to float a question out here in the meantime...

I'm wondering how to go about refreshing the content of a control (say, a
selector) without refreshing the page. For example, if I have these selects:

Company: <pick a company>
Contact: <pick a contact>

When they pick the company, I'd like to refill the contact selector based on
who works for that company, but I don't want to refresh the form since the
record hasn't been saved yet.

I know I could use a hidden form or some embedded component to do an HTTP
pull, but we have a live support app that we use and it seems like it might
be keeping the connection to the server open until it's unloaded from the
browser, so I was curious if that's doable, and how big a resource hog it
is. We'll only have occasional instances where we'd need to do this sort of
thing, but in those cases it would probably be worth it. I've been poking
around in the live support code to find out how they do their refreshes, but
I'm kind of new to PHP and I haven't spotted the answer yet.

Thanks in advance...
Jul 17 '05 #1
10 5016
On Thu, 25 Sep 2003 15:18:28 -0400, "Philo Del Middleston"
<bi*******@sobr anisoft.com> wrote:
I've been searching, but apparently not phrasing my search right, so I'm
going to float a question out here in the meantime...

I'm wondering how to go about refreshing the content of a control (say, a
selector) without refreshing the page.


Javascript.

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #2
Clearly I have to use Javascript for the client piece...

The question is about how to do the server pull to get the fresh data. We
have some clients with very large databases - I don't want to pull down the
entire contacts table just so I can refresh the selector if the company
changes.
"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:h7******** *************** *********@4ax.c om...
On Thu, 25 Sep 2003 15:18:28 -0400, "Philo Del Middleston"
<bi*******@sobr anisoft.com> wrote:
I've been searching, but apparently not phrasing my search right, so I'm
going to float a question out here in the meantime...

I'm wondering how to go about refreshing the content of a control (say, a
selector) without refreshing the page.


Javascript.

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

Jul 17 '05 #3
Philo Del Middleston wrote:
I've been searching, but apparently not phrasing my search right, so I'm
going to float a question out here in the meantime...

I'm wondering how to go about refreshing the content of a control (say, a
selector) without refreshing the page. For example, if I have these selects:

Company: <pick a company>
Contact: <pick a contact>

When they pick the company, I'd like to refill the contact selector based on
who works for that company, but I don't want to refresh the form since the
record hasn't been saved yet.

I know I could use a hidden form or some embedded component to do an HTTP
pull, but we have a live support app that we use and it seems like it might
be keeping the connection to the server open until it's unloaded from the
browser, so I was curious if that's doable, and how big a resource hog it
is. We'll only have occasional instances where we'd need to do this sort of
thing, but in those cases it would probably be worth it. I've been poking
around in the live support code to find out how they do their refreshes, but
I'm kind of new to PHP and I haven't spotted the answer yet.

Thanks in advance...


Sounds a little confusing to me. What it sounds like you want is to make
an onChange event for a SELECT element to display information based on
that option's value. This sounds like you will need to make at least one
HTTP/database request for each of the options - or for each time it's
changed. I'd suggest an iframe element, then in the onChange javascript
method, simply treat the IFRMAE as a named window (similar to in
framesets), and reload its content that way.

However, I think your comments about live support app and open server
connections are confusing me. If you want to make no more subsequent
requests until the data from the form is recorded, you'll have to find
all the possible choices and save the content for those somewhere
(likely with hidden elements) and make them visible when that option was
chosen. However, it would seem to be much more efficient to request the
data according to what the user chose since they aren't likely to go
through every option (or are they?).

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 17 '05 #4
The other guy that responded with "Javascript ," while less than helpful, was
actually correct. I haven't gotten to try it yet, but here's a page that
appears to explain what I'm attempting to do:

http://www.webxpertz.net/faqs/jsfaq/jsserver.php

The whole application engine is XML based, and designed to run in a Windows
client app or over the web. In the client app I can use window.external
calls to pull whatever I need out of the database to rebuild an element, but
I wasn't sure how I was going to translate that to the web version. I wanted
to avoid using ActiveX controls or plugins since I don't want to be locked
in to IE (although I will require a Javascript enabled browser).

I would catch the onchange event for the first selector, make a quick fetch
for the new set of contact names and id's for the new company selected, then
rebuild the option list in the second selector.

The live support app is doing image.src manipulation to do server pulls,
although I never teased out exactly how they were getting the results. I'll
have to go back now and see if they're doing DOM tricks like this article
talks about.
Sounds a little confusing to me. What it sounds like you want is to make
an onChange event for a SELECT element to display information based on
that option's value. This sounds like you will need to make at least one
HTTP/database request for each of the options - or for each time it's
changed. I'd suggest an iframe element, then in the onChange javascript
method, simply treat the IFRMAE as a named window (similar to in
framesets), and reload its content that way.

However, I think your comments about live support app and open server
connections are confusing me. If you want to make no more subsequent
requests until the data from the form is recorded, you'll have to find
all the possible choices and save the content for those somewhere
(likely with hidden elements) and make them visible when that option was
chosen. However, it would seem to be much more efficient to request the
data according to what the user chose since they aren't likely to go
through every option (or are they?).

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 17 '05 #5
On Thu, 25 Sep 2003 17:52:44 -0400, "Philo Del Middleston"
<bi*******@sobr anisoft.com> wrote:
The other guy that responded with "Javascript ," while less than helpful, was
actually correct. I haven't gotten to try it yet, but here's a page that
appears to explain what I'm attempting to do:

http://www.webxpertz.net/faqs/jsfaq/jsserver.php

The whole application engine is XML based, and designed to run in a Windows
client app or over the web. In the client app I can use window.external
calls to pull whatever I need out of the database to rebuild an element, but
I wasn't sure how I was going to translate that to the web version. I wanted
to avoid using ActiveX controls or plugins since I don't want to be locked
in to IE (although I will require a Javascript enabled browser).

I would catch the onchange event for the first selector, make a quick fetch
for the new set of contact names and id's for the new company selected, then
rebuild the option list in the second selector.

The live support app is doing image.src manipulation to do server pulls,
although I never teased out exactly how they were getting the results. I'll
have to go back now and see if they're doing DOM tricks like this article
talks about.


Interesting stuff - hadn't occurred to me you could get the client to request
and replace Javascript source using Javascript itself - I suppose it's part of
the DOM after all so there's no reason why not.

Provided you know your clients can handle this sort of fiddling it could be
quite useful; this might actually end up applying to something on the intranet
at work that's been bothering me... thanks!

(My reply was overly brief as it looked like it was going offtopic)

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #6
"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:08******** *************** *********@4ax.c om...
On Thu, 25 Sep 2003 17:52:44 -0400, "Philo Del Middleston"
<bi*******@sobr anisoft.com> wrote:
(My reply was overly brief as it looked like it was going offtopic)


Well, I knew that this live support product was pulling the data out with
PHP, so this seemed like the right place to go. I knew I could get the data
into the document with Javascript, but getting the data looked like it was
going to be a trick. Brief as your answer was, you got me headed in the
right direction. I'll probably give this a shot tonight or tomorrow and I'll
report back with my results.
Jul 17 '05 #7
Hi Philo!

On Thu, 25 Sep 2003 15:43:14 -0400, "Philo Del Middleston"
<bi*******@sobr anisoft.com> wrote:
Clearly I have to use Javascript for the client piece...

The question is about how to do the server pull to get the fresh data. We
have some clients with very large databases - I don't want to pull down the
entire contacts table just so I can refresh the selector if the company
changes.

Its really a question for comp.lang.javas cript and I actually asked it
there 3 weeks ago. Short:

- Use an iframe or different frame
- Reload the frame with javascript and have a javascript array there.
- copy it over into your select-box with javascript

HTH, Jochen


"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:h7******* *************** **********@4ax. com...
On Thu, 25 Sep 2003 15:18:28 -0400, "Philo Del Middleston"
<bi*******@sobr anisoft.com> wrote:
>I've been searching, but apparently not phrasing my search right, so I'm
>going to float a question out here in the meantime...
>
>I'm wondering how to go about refreshing the content of a control (say, a
>selector) without refreshing the page.


Javascript.

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)


--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #8
"Jochen Daum" <jo*********@ca ns.co.nz> wrote in message
news:ek******** *************** *********@4ax.c om...
Hi Philo! Its really a question for comp.lang.javas cript and I actually asked it
there 3 weeks ago. Short:

- Use an iframe or different frame
- Reload the frame with javascript and have a javascript array there.
- copy it over into your select-box with javascript


Our original scheme had been to use a hidden frame, but I was looking for an
alternative. Our live support app was clearly not doing it that way, so I
was trying to figure out how they were.

I did find something that looks promising on another branch of this thread.
Jul 17 '05 #9
I managed to get this tecnique working with my APP, and it's a very nice
trick. I'm pleased to know that I now have a solution that will work both on
the web and from my hosted browser control without resorting to
window.external , hidden frames, or any other kind of weird crap.

I found one other article that walks you through the same technique one step
at a time - it helped me identify a few problems that I had in my
implementation and get the thing running:
http://www.dhtmlcentral.com/tutoria...rials.asp?id=11

"Philo Del Middleston" <bi*******@sobr anisoft.com> wrote in message
news:iK******** *********@bigne ws5.bellsouth.n et...
"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:08******** *************** *********@4ax.c om...
On Thu, 25 Sep 2003 17:52:44 -0400, "Philo Del Middleston"
<bi*******@sobr anisoft.com> wrote:
(My reply was overly brief as it looked like it was going offtopic)


Well, I knew that this live support product was pulling the data out with
PHP, so this seemed like the right place to go. I knew I could get the

data into the document with Javascript, but getting the data looked like it was
going to be a trick. Brief as your answer was, you got me headed in the
right direction. I'll probably give this a shot tonight or tomorrow and I'll report back with my results.

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4318
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image button at runtime: //----- Code snippet protected System.Web.UI.WebControls.PlaceHolder ImageHolder; private void Page_Load(object sender, System.EventArgs e)
4
12420
by: Grigs | last post by:
Hello, I have an asp:table on my page. I am, after a button gets clicked, programmatically adding rows and their cells. Using the Cell.Text = to put the value in the cell. I then have another button (which will eventually print form the server) that refreshes the page of course. When the page gets refreshed, none of my rows of the table (except the static header area) remain. I figured it was an .EnableViewState issue so I do a...
5
9774
by: Angel | last post by:
Is there a way to create an IFRAME dynamically via VB.NET. In other words creating the HTML element in the server side code? thanks in advance....
27
13080
by: ted benedict | last post by:
hi everybody, i hope this is the right place to discuss this weird behaviour. i am getting dynamically generated text or xml from the server side using xmlhttprequest. if the server side data is STATIC, i can have whatever size of data i want. but if the data (xml or text) is generated dynamically using php, then there seems to be a size limit! xmlhttprequest's responseText is truncated, and the xml therefore not well fromed. in border...
21
29838
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays prodcut anme have used ajax to avoid refreshing of page this works fine 2.now i have created one row with checkbox|select box|text|text|text|text| where in the select box values are fetched from table here also i have used ajax for getting the m_name...
7
6676
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe Stagner)
9
4437
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have to open a bunch of pages as diaogboxes, I created a general page(Container.aspx) which has an iframe...
0
2068
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have to open a bunch of pages as diaogboxes, I created a general page(Container.aspx) which has an...
3
5279
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first add the pane the remove event does not get handled, though thereafter it is handled without problems. ==================================================
0
9716
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
10609
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
10360
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
10366
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
10105
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
6876
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
5542
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...
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.