You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jonathan O'Connor <Jo...@xcom.de> on 2005/04/07 14:41:58 UTC

Re: How to localize file upload button? [auf Viren geprueft]

Chan,
It is the browser that decides how to display the browse button in a file 
type input. If all you want is to make sure that it says "Browse" in 
English, or for example "Durchsuchen" in German. You probably can't test 
this on your own machine. So don't worry about it.

If you want to change the color or the style of the button, then you have 
to use various hacks, similar to the one you describe, but that's all they 
are. Hacks! You can specify the style for the file input, but some 
browsers apply this to the text input, and others to the browse button. 
I've seen hacks where javascript hides the file control, and mimics it 
with a text input and submit button. The trick is to position the hidden 
browse button over the mimiced browse button. Then when the user clicks on 
what they see as the visible button, it actually invokes the real browse 
button.  But as you can see its a horrible hack, and not guaranteed to 
work.

Summary, don't bother trying to change it.

Ciao,
Jonathan O'Connor
XCOM Dublin



Chan Sammy <cs...@gmail.com> 
07/04/2005 11:34
Please respond to
"Tapestry users" <ta...@jakarta.apache.org>


To
tapestry-user@jakarta.apache.org
cc

Subject
How to localize file upload button? [auf Viren geprueft]






I almost succeed in localizing the file upload button by this:

<form method="post" name="Form0" action="/cschan/app"
enctype="multipart/form-data" enctype="multipart/form-data">
                 <input type="file" name="upload" style="display: none;" 
id="Upload2"/> 
                 <input type="text" id="file2" size="40"/> 
                 <input  name="upload1" type="button"
onClick="
javascript:document.getElementById('Upload2').click();document.getElementById('file2').value=document.getElementById('Upload2').value
;"
value="Upload" />
                 <input type=submit name=file1 />
</form>

It uses a fake text field and button in place of the file upload
widget, and route button click event to the real file upload button.

However, it won't work when this form is submitted, unless I remove
the name attribute of the Upload component. Of couse, name is a must
for rewind in tapestry to work, and is generated by the Upload
component. It is not possible to remove it. Do anyone have other ways
to localize the "text" of the fie upload button?

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org






Archivierung fuer Lotus Notes
Lotus Notes Unterstuetzung fuer den Open Source basierten XCOM Archivkern: http://lotus.xcom.de/archiv

Mobilize Your Business:
Machen Sie Ihren Applikationen Beine - auf PDA, SmartPhone und Communicator: http://lotus.xcom.de/mobile


*** XCOM AG Legal Disclaimer ***

Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist allein fur den Gebrauch durch den vorgesehenen Empfaenger bestimmt. Dritten ist das Lesen, Verteilen oder Weiterleiten dieser E-Mail untersagt. Wir bitten, eine fehlgeleitete E-Mail unverzueglich vollstaendig zu loeschen und uns eine Nachricht zukommen zu lassen.

This email may contain material that is confidential and for the sole use of the intended recipient. Any review, distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org