Customize the “select file” Button Text, “Drop files here” Text, and “or” Text for a Specific Field

Instructions

  1. Install our free Custom Javascript for Gravity Forms plugin. Download the plugin here: https://gravitywiz.com/gravity-forms-code-chest/
    1. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin.

Code

Filename: gpfup-customize-select-file-button-text.js

/**
 * Gravity Perks // File Upload Pro // Customize the “select file” Button Text, "Drop files here" Text, and "or" Text for a Specific Field
 * https://gravitywiz.com/documentation/gravity-forms-file-upload-pro/
 *
 * Instructions:
 *   1. Install our free Custom Javascript for Gravity Forms plugin.
 *      Download the plugin here: https://gravitywiz.com/gravity-forms-code-chest/
 *   2. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin.
 */
window.gform.addFilter( 'gpfup_strings', function( strings, formId, fieldId ) {
	// Update '123' to the Form ID and '4' to the File Upload Field ID.
	if ( formId != 123 || fieldId != 4 ) {
		return strings;
	}

	strings.select_files    = 'Select an image';
	strings.drop_files_here = 'Drag and drop images';
	strings.or              = ' OR ';

	return strings;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.