June 8, 2010

XPages: Modifying Button Text in File Upload Control?

I'm currently working on create a page, using XPages, where the users amongst other things are able to upload files. Simply dragging and dropping a File Upload Control onto the page works fine, but I would also like to modify the text on the browse button that is automatically provided by the Dojo framework.

It seems to me that the text on the button is set to the default "browse text" of the system. On other buttons on the page, e.g. the submit button, I am able to set the label of the button (see picture below, which is then displayed as the button's text. This does not work for the browse button...

Label field of an XPages Button, where is the same field for a File Upload Control?


Does anybody know what I need to do to be able to set the text of the file upload control button to whatever string I want to?

5 comments:

  1. You cant. Basically, for security purposes, the browser upload control is controlled, pretty much 100% by the browser. You can't style it, you can't change its text, you can't script it. It's meant to have nothing between it and the user as to prevent malicious use of the upload.

    ReplyDelete
  2. All right, then. That's what I kinda was thinking, but still hoping there might be a solution to it...
    Thanks for the confirmation!

    ReplyDelete
  3. It should be possible by putting an image over the 'browse' button, see here
    http://www.quirksmode.org/dom/inputfile.html.

    Ferry

    ReplyDelete
  4. Thanks for your input, Ferry!

    ReplyDelete
  5. I've noticed that IE puts the button after the field, where most sensible browsers put the button before the field. I imagine the hack referenced by Ferry would solve that problem if you want consistency.

    ReplyDelete