Disable Submit During Upload

Use this snippet alongside our free Gravity Forms Custom JavaScript plugin to disable the submit button while files are being uploaded.

Instructions

Code

Filename: gpfup-disable-submit-during-upload.js

/**
 * Gravity Perks // File Upload Pro // Disable Submit During Upload
 * https://gravitywiz.com/documentation/gravity-forms-file-upload-pro/
 *
 * Instruction Video: https://www.loom.com/share/e35cf2da108b4064b3b33ea5d65ed021
 *
 * Use this snippet alongside our free [Gravity Forms Custom JavaScript][1] plugin to disable
 * the submit button while files are being uploaded.
 *
 * [1]: https://gravitywiz.com/gravity-forms-code-chest/
 */
gform.addAction( 'gpfup_uploader_ready', function( gpfup ) {
	gpfup.Uploader.bind( 'UploadFile', function() {
		$( '.gform_button' ).prop( 'disabled', true );
	} );
	gpfup.Uploader.bind( 'UploadComplete', function() {
		$( '.gform_button' ).prop( 'disabled', false );
	} );
} );

Comments

  1. aaron wimberley
    aaron wimberley September 13, 2024 at 11:42 am

    Thanks for the suggestions. Unfortunately this wouldn’t accomplish what I attempting to do. I would need to disable the submit button entirely. Appreciate your reply though!

    Reply
    1. Sebastian Pedersen
      Sebastian Pedersen Staff September 14, 2024 at 12:41 pm

      Hi Aaron,

      You can try out this modified version of the snippet, it will also disable the submit button while no files has been selected.

      Alternatively, you can check out this snippet, it will disable the submit button until all Required fields are filled out.

      Cheers,

  2. aaron wimberley
    aaron wimberley September 13, 2024 at 9:14 am

    Is there a way to disable the submit button entirely until files are uploaded? Basically making file upload pro conditional so the user must upload files to submit the form?

    Reply
    1. Rob Anderson
      Rob Anderson Staff September 13, 2024 at 10:01 am

      Hi Aaron,

      You could make the File Upload field required by ticking the “Required” option in General Settings. This won’t disable the Submit button, but it will force a user to add a file to successfully complete the form.

      Best,

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.