- barqAsked on June 19, 2012 at 10:02 AM
I just posted here before: http://www.jotform.com/answers/-Is-it-possible-to-hide-empty-fields-from-the-submission-email and here's a new forum entry like you requested.
Here's a link to the form:
One thing I'm wondering is, what if I change the form after I have added the code to the form. Will I have to redo the scripting again?
Here's the original mail I posted:
Any general way to apply this technique to other forms for other Jotform users? I'm actually sitting with the exact same problem (doing a job application form with lot's of IF-THEN logic in it), and I can't see how to customize your code to make it work here. Maybe 75% of the fields I receive are empty, so it could be great to hide those fields.
All the best
- JotForm SupportjonathanAnswered on June 19, 2012 at 10:08 AM
I got your post.
On your question.
Since you will be using source code embed of the form, you will be force to re-embed it in your website.
But it is easy to re-apply the script function code... just copy the same block of code to the form code again.
I will try to create this on my test site using your form this time.
Will update you when I can on my progress.
- JotForm SupportjonathanAnswered on June 19, 2012 at 07:06 PM
I have created the test forms using a clone of yours here:
Regular Form (no custom function)
Final Form (with custom function)
Please try them and check if this is applicable to your requirements.
After submission, you can check the Notification email here.
Will await your update.
- barqAnswered on June 20, 2012 at 05:54 AM
Thanks for your help! I tried the final form with the custom function (I assume it's this one I need to try?). And it seems to have worked, except a few fields that still showed up despite them not being filled:
• In which time zone are you located?
• Internet Connection Speed (Download)
• Internet Connection Speed (Upload)
• Phone Number
Any ideas, how to remove them?
Besides that it's perfect! I'm wondering how to integrate it?
- flickenvyAnswered on June 20, 2012 at 06:08 AM
I had the same issue, from what i understand is you dont want the fields that are blank to show up in the email notifications..
To do this use the conditions option under setup
Set a condition on the fields to hide when left blank, this will stop them from appearing in the email..
- JotForm SupportjonathanAnswered on June 20, 2012 at 07:26 AM
I have updated the function code. It should now includes excluding emtpy drop down fields. You may like to test again.
I cannot hide the Phone Number anymore because I don't have the supporting code for the conjunction fields. As you can see it has a default value "()" which make it not empty.... Perhaps you can use another field for it (an ordinary text box field will do)
<button id="input_91" type="submit" class="form-submit-button form-submit-button-simple_blue" onclick="checkFileFields();">
Send my application!
You can right-click on my test page and view its source to see how I applied it.
Please inform us if you need further assistance.
Thank you very much for your input. In another scenario, I agree that your suggestion will work too. =)
But we do have a different case on this one... The form was a multi-page form and there is a potential to have multiple empty fields (not required). Using the show/hide condition could complicate it even more.
- barqAnswered on June 20, 2012 at 08:51 AM
I tried to implement it here:
But unfortunately it still sends me all the content. I think I have inserted it correctly?
- JotForm SupportjonathanAnswered on June 20, 2012 at 09:01 AM
Truly sorry., I missed to inform you.. in the code, please change the form ID# to yours (21703123301333 in your test web page)
- barqAnswered on June 20, 2012 at 09:10 AM
No problem! Now it works! Thanks a lot, really appreciate your hard work on this! This form has become perfectly readable now. I'm really amazed by the kind of support you provide here at jotform - you don't just leave us hanging with some highly technical fix, but you actually help us implement it so that it works! Thumbs up for that!
Have a great day!
All the best
- JotForm SupportjonathanAnswered on June 20, 2012 at 09:14 AM
All the best Anders. =) JotForm team is glad to be of service as always.
- jaycw7Answered on August 29, 2012 at 01:57 AM
I am having this same concern. The form submissions will go to my clients as service agreements. I need to be able to have their copy (or all copies) avoid including all the blank fields or it just looks like garbage. And I have no idea what you guys were talking about above. Is there an easier way now?
Or can anyone suggest a form builder where you can do this...easily?
- JotForm SupportidarktechAnswered on August 29, 2012 at 03:38 AM
Unfortunately, there's no direct solution for this. Our form builder doesn't have this option at this moment.
//replace 21704110387445 with your FORM ID
var form = document.getElementById("21704110387445");
//get all elements in the form, e.g. the input fields
var formElements = form.elements;
//initialize an array that stores all the elements that later get deleted, don't delete when you find the element, otherwise you change the formElements array size and miss another field
var toDeleteElements = ;
for (x in formElements)
//each element that has type='file' and value is 0 is what we want to delete later
if(formElements[x].type=="text" || formElements[x].type=="textarea" || formElements[x].type=="radio" || formElements[x].type=="checkbox" || formElements[x].type=="select-one" || formElements[x].type=="file")
if (formElements[x].value=="") //if empty field
for (x in toDeleteElements)
//remove element from its own parent
After that add this event onclick="checkFileFields();" on your form button's input code.
You can also inspect my colleague's page source here to see how it's declared. http://batangas-ventures.com/jotform/testusers/Hide-Empty-Email-Fields-Final.html. Check his example's above for a demo.
Let us know if you need further assistance. Thank you.
- JotForm SupportkennethAnswered on March 23, 2013 at 04:47 AM
We have a new feature in jotform. This is the "Hide Empty Fields on Emails" from advance tab under Preferences. Have you tried these already? Please confirm if these works in your side.
Note: if the email alert has been edited, it becomes now 'dirty' if how we call it. Which means the said feature will not be work anymore, unless you recreate the email alert.
- JotForm SupportBJoannaAnswered on June 13, 2016 at 01:38 PM
I have moved your question to separate thread and we will provide you an answer there shortly.