#1
  1. No one Important
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Australia
    Posts
    524
    Rep Power
    15

    Help with Javascript Button Window.status


    Hi there,

    I am trying to include a button in my webpage so that wen I upload a file, the instance of the button changes to provide them with a message that the file is uploading.

    However, this does not appear to work in netsape 4.7. So what I would like to do is to display the message in the status bar also while the instance has changed. The code I use is as follows:-
    Code:
    <input onclick="if(this.value=='Please Wait Uploading....')return(false);if((document.AV_LOADED!=null)&&!AV_onSubmit(this.form))return(false);this.value='Please Wait Uploading....';" type="submit" value="UPLOAD NOW">
    If someone could have a look at this for me and let me know what I need to do to include the status bar message while the file is uploading, and then retuning a false value to clear it when it has completed and the page has reloaded.

    Cheers
  2. #2
  3. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    File upload confirmation is a server-side process; generating confirmation messages on the client is pretty pointless. Since you're loading a new page (the form's action attribute) all running scripts are lost when the document is cleared.

    Maybe this'll help - otherwise you might try the server-side forums:
    http://www.thickbook.com/extra/php_fileupload.phtml
  4. #3
  5. No one Important
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Australia
    Posts
    524
    Rep Power
    15
    Hey tere, the Uploading of the file is not the problem, that is occuring correctly and working fine. While the file is uploading, the above code changes the cutton to say 'Please wait Uploading....', instead of the chosen Upload Now Status. However, the changing of the button fails to work in netscape 4.7, so I thought that in conjunction with changing the Button status, that I change the status bar on the bottom of the browser to say they same thing while the file is uploading and the page refreshes.

    I have managed to get this status to appear while the file is upload, however I have been having problems with getting window.status returning a flase or null value when the page is refreshed. if you can understand what I mean.

    Thanks, hopes this clarifies a little more.
  6. #4
  7. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Well, I'm a little confused here...
    Try this:
    Code:
    <form enctype="multipart/form-data" method="post" 
    action="javascript&#58;for(k=0;k<1000;k++){}" onsubmit="this.sub.value='...uploading'">
    <input name="up" type="file"><br>
    <input name="sub" type="submit" value="UPLOAD NOW">
    </form>
    The for loop is just a delay for demo purposes.
    There are other ways to do this as well; the status line is often the last place anybody looks (*teeny*)
  8. #5
  9. No one Important
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Australia
    Posts
    524
    Rep Power
    15
    Ok then. so what you are saying is do not worry about the Netscape users to the site?

    I would have loved to have done something for them, but if it is not really possible then I will not worry about it.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Nov 2001
    Posts
    1,882
    Rep Power
    20
    You could try

    onClick="window.status='...Uploading'"

    in the Button code.
  12. #7
  13. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    mystik_web -

    The above does update the button, in my testing (NS4.76/Windows 2000)...are you talking about the "browse" button? - its legend is hardwired; its .value property refers to the file selected (read-only).
    Last edited by adios; November 19th, 2001 at 07:24 PM.
  14. #8
  15. No one Important
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Australia
    Posts
    524
    Rep Power
    15
    No, sorry I am not talking about the browse button I am talking about the submit button.

    What the code does:-

    <input onclick="if(this.value=='Please Wait Uploading....')return(false);if((document.AV_LOADED!=null)&&!AV_onSubmit(this.form))return(false);th is.value='Please Wait Uploading....';" type="submit" value="UPLOAD NOW">

    Is when the user has browsed for the file to upload and selected this. They click on the submit button, or in this case 'UPLOAD NOW'.
    What the javascript is currently doing is, while the PHP script is uploading (copying) the file to the required location, it changes the 'UPLOAD NOW' text on the button to say "Please wait Uploading.....' Then when the page has loaded and refresh with a $PHP_SELF, the button returns to normal.

    What I am trying to acheive is that, because in netscape 4.7 the button does not change, I wanted to include a little bit more JS on the button to ALSO display the 'Please Wait Uploading...' in the status bar of the browser while the submited form file is being copied to the web server.

    I hope that this is making a little more sense... sorry for any confusion.

IMN logo majestic logo threadwatch logo seochat tools logo