Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts

    update input value to returned value from external file.

    Hi! me again
    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:
    Code:
    document.images.img_tag_name.src = 'image.php'
    and now, I need update with current image path value of <input>
    if I do:
    Code:
    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.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #3
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #5
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    as u can see, in the <input> it shows the current "file" it call, but not the value returned by that file...

  • #6
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #7
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #9
    Regular Coder
    Join Date
    Feb 2003
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank u very much!
    will give it shot.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •