Real Time Updates

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
comtek
Forum Commoner
Posts: 39
Joined: Tue Feb 17, 2004 10:46 pm

Real Time Updates

Post by comtek »

I have a form that allows a visitor to make selections from drop down boxes, click a submit button, and have the total of there selections updated on the same page. I want to make this a real time update that is done without having to click a button to update. How can this be done? I have been told it can be done with Sessions, and I have also been told it would have to be done using a client-side javascript. I would prefer to use PHP because this is what I am trying to learn. I have not been able to find any relevant examples of PHP or Java. Any direction would be greatlt appreciated.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

It will have to be client side for it to be 'real time' (i.e with no new request to the server) and as PHP is on the server side then it can't be done (with PHP).
There's lots of javascript scripts out there that can handle this for you.
PAW Projects
Forum Commoner
Posts: 30
Joined: Tue Jun 15, 2004 7:43 am
Contact:

Post by PAW Projects »

It can be real time by using a hidden IFRAME.
On selection of one of the options in the dropdown, a javascript file is loaded into the IFRAME, which in turn changes the content of the page.

With or without the use of PHP, JavaScript is going to be involved.
Last edited by PAW Projects on Wed Jun 16, 2004 4:28 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

moving to client-side.
comtek
Forum Commoner
Posts: 39
Joined: Tue Feb 17, 2004 10:46 pm

Post by comtek »

OK Java it is. Know of any examples? I have been looking but don't know enough about Java to know whether they are appropriate or not. Thanks for your input so far.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

comtek wrote:OK Java it is.
Just a note that Java and Javascript are two very different languages.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
comtek
Forum Commoner
Posts: 39
Joined: Tue Feb 17, 2004 10:46 pm

Post by comtek »

Would the html "onchange" command work? At this point I do not need to pull more info from server.... all the choices needed will already be in the drop down boxes. I am currently using some simple PHP code to display the sum of the choices on the same page, once a submit button is hit.
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

i am not good with javascript, but here goes...

Code: Select all

<script>
function lable(value)
&#123;
document.layer.bla.text = value;
&#125;
</script>
<layer name="bla"></layer>

<form name="form">
<select name="options" onchange="lable(this.value)">
<option value="value 1">value 1</option>
<option value="value 2">value 2</option>
</select>
</form>
something like that :P, shouldt work (if it does, yay for me), but it should give you a idea it.
comtek
Forum Commoner
Posts: 39
Joined: Tue Feb 17, 2004 10:46 pm

Post by comtek »

OK. thanks. This give me good direction and something to work with. Many thanks
Post Reply