Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to hide certain fields to not show in sheets #306

Closed
CodeCurosity opened this issue Jan 22, 2019 · 5 comments
Closed

How to hide certain fields to not show in sheets #306

CodeCurosity opened this issue Jan 22, 2019 · 5 comments

Comments

@CodeCurosity
Copy link

I have few hidden fields and i don't want them to be submitted to sheets, how can i prevent that? certain hidden fields, i want to show 2 hidden fields but hide 1?

@mckennapsean
Copy link
Collaborator

https://github.com/dwyl/learn-to-send-email-via-google-script-html-no-server/blob/master/form-submission-handler.js#L35

Just hard-code the name of those hidden fields into the JS. Have it return early for those names, and they won't be included in the formData.

@CodeCurosity
Copy link
Author

Can you please give me an example code for 2 fields with different names so its easier for me, thanks.

@mckennapsean
Copy link
Collaborator

mckennapsean commented Jan 25, 2019

fields.forEach(function(name){
  if (name === 'dont-show' || name === 'dont-show2') {
    return;
  }
  // when you want to keep the field, do the normal stuff here
});

@CodeCurosity
Copy link
Author

CodeCurosity commented Jan 25, 2019

this doesn't seem to work for me with jquery.ajax, i just want to hide all hidden field types, here is my jquery ajax

jQuery(document).on("submit", "form", function(event){
event.preventDefault();
jQuery("#loadingimg").show();
var url=jQuery(this).attr("action");
jQuery.ajax({
url: url,
type: jQuery(this).attr("method"),
data: new FormData(this),
processData: false,
contentType: false,
success: function (data, status, jqXHR, response) {
    swal("Thank You!", "Your message has been submitted!", "success");
    jQuery("#loadingimg").hide();
    jQuery('.mform').trigger("reset");

  },

});

@mckennapsean
Copy link
Collaborator

GitHub is not a help forum for random code. This isn't how we parse the data, so I'd suggest looking it up or asking in a forum such as Stack Overflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants