...

View Full Version : update input value to returned value from external file.



V@no.
04-03-2003, 12:54 AM
Hi! me again :D
I'm trying make dinamicaly updated value in <input>
yes, I know I can use something like:
document.form_name.input_name.value = "whatever"
but how can I insert value returned after executing an external file?
in my case image.php will return path to current image.
I use it for changing images (slideshow), works perfect with this code:
document.images.img_tag_name.src = 'image.php'
and now, I need update with current image path value of <input>
if I do:
document.form_name.input_name.value = 'image.php'
my <input> value will show "image.php" instead of real path to the image.
so, is there a way to actual "execute" image.php file from JS and update <input> value with returned from the .php file value?
thx.

whammy
04-03-2003, 01:05 AM
Not unless you refresh the page... I think you may need to study the differences between client-side and server-side scripting.

In order to return a value from a server-side language, you have to send something to the server - your browser doesn't just automatically do that, unless you submit a form...

I'm sure there is a way to do this using a hidden frame, an iframe, or perhaps remote scripting, but I usually use ASP and couldn't help with that.

This should really be in the PHP forum. ;)

V@no.
04-03-2003, 01:09 AM
Originally posted by whammy
Not unless you refresh the page... I think you may need to study the differences between client-side and server-side scripting.

In order to return a value from a server-side language, you have to send something to the server - your browser doesn't just automatically do that, unless you submit a form...


then, how come it works for <img src> ?
it does send request to the server and change image to the source it received from the .php file.


This should really be in the PHP forum
actualy the .php part is done and its working, only JavaScript part doesnt ;)

whammy
04-03-2003, 01:14 AM
What is image.php returning when you use it for an input field?

Let's see your code... I still think this is still a question for the PHP forum, though...

V@no.
04-03-2003, 01:36 AM
ok, see it yourself:
http://come.no-ip.com/slideshow.php?cat_id=78
I dont want post source of slideshow.php, because it's hudge, it does everything there :rolleyes:
as u can see, in the <input> it shows the current "file" it call, but not the value returned by that file...

V@no.
04-03-2003, 01:55 AM
I just looked in my site log and see that there are requets like:
slideshow.php?SlideShowName=slideshow.?show=2&cat_id=78&offset=8
where:
SlideShowName - <input> name
how da heck it went there like this? no wander slideshow.php doesnt know what to do with such a query...

V@no.
02-29-2004, 02:46 AM
Ok, let me rephrase my question:
how can I include content of a text file by using JS?
is it possible that JS would "download" that file and then output to the screen its content?
any ideas?

Vladdy
02-29-2004, 02:54 AM
http://www.codingforums.com/showthread.php?s=&threadid=30449

V@no.
02-29-2004, 02:57 AM
Thank u very much!
will give it shot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum