Serverless File Uploads for Gravity Forms with Logic

Hello all!

I followed the brilliant implementation guide to integrate uploadcare with Gravity Forms. However, one last step is missing: I want to show the upload button only if another text field contains “.

Any idea how I can implement this? I found the post_conditional_logic_field_action already (gform_post_conditional_logic_field_action - Gravity Forms) but I can’t make it work somehow.

Hi @lt1,

Thanks for the question and sorry for the radio silence in this thread!

I have little knowledge of Gravity Forms, but according to the docs, the post_conditional_logic_field_action hook doesn’t seem to help in this case. You should probably take a look at grorm_input_chage (link) instead.

Without using Gravity Form hooks and API, I think it can be solved with some JS like this

$("#text-input").on("keyup", function() {
  var val = $(this).val();
  if (val.indexOf(".") !== -1) {
    $("#file-upload-field").show();
  } else {
    $("#file-upload-field").hide();
  }
});

Where #text-input is the id of the text field you check and #file-upload-filed is the id of the form field that contains the upload button.

Be sure to put it at the end of your scripts probably at the footer tag or at the end of the body tag.