function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NakataNakata 

How can we change the value of browse button

Good day All, 

 

I have create input file component in the page. some questions here 

 

1. How can i change the text value of "browse" button, currently it show me 'Browse'  ?

2. How can 'Browse' text value get change based on different language ? we can't have label for 'Browse' text value right ?

 

Thank you ! 

 

VF page :

 

<apex:form id="theForm"> <apex:pageBlock > <apex:pageBlockSection > <apex:inputFile value="{!document.body}" filename="{!document.name}"/> <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form>

 

 

bob_buzzardbob_buzzard

I don't think you can change the text of the Browse button.  This is produced by the browser and is intentionally not under the control of your page/javascript as it allows access to files on the user's os.  This is to stop unscrupulous page author's making the browse button look like something else and conning the user into uploading sensitive data.

 

I would expect the text of the button to change according to the locale of the user's underlying OS.

stephanstephan

You might try the technique described here:

 

http://www.quirksmode.org/dom/inputfile.html

arnaud_carnaud_c

Hi,

 

I am looking to create this browse button in a custom object on my org. I believe you are referencing the visualforce page in a custom button right?

 

if so, can you please send me your full page code so I cam implement this.

 

Cheers

Rajiv BhattRajiv Bhatt
@stephan The technique mentioned on quirksmode indeed gave me the clue on how this could be resolved.

@all: The solution is to :

1. create a custom input text element with the standard button styling
2. overlay that element on top of the "choose file" button
3. write javascript code to handle the click on the custom element
4. trigger the click() of standard "choose file" when custom element is clicked.

You may find the solution described in detail with code on my blog post --> https://sfdc-gyaan.rhcloud.com/2014/05/renamingoverriding-choose-filebrowse-button-in-salesforce/

I hope this helps.