What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How do to hide unused fields in submission emails

    Asked by barq on June 19, 2012 at 10:02 AM

    Hi Jonathan,

    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:

    -------

    Hi Jonathan,

    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

    Anders

    E-mails email hide unused fields unanswered blank email blank field hide unfilled fields hide empty fields notification emails email alerts
  • Profile Image
    JotForm Support

    Answered by jonathan on June 19, 2012 at 10:08 AM

    Hi Anders,

    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.

    Thanks.

  • Profile Image
    JotForm Support

    Answered by jonathan on June 19, 2012 at 07:06 PM

    Hi Anders,

    I have created the test forms using a clone of yours here:

    Regular Form (no custom function)

    and

    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.

    Thanks.

  • Profile Image

    Answered by barq on June 20, 2012 at 05:54 AM

    Hi Jonathan,

    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?

  • Profile Image

    Answered by flickenvy 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..

  • Profile Image
    JotForm Support

    Answered by jonathan on June 20, 2012 at 07:26 AM

    Hi Anders,

    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)

    To use this function, simply copy the javascript code and include in your form source code embed when you embed it in your website. To trigger the function put the code in the submit button "on-click" event.

    <button id="input_91" type="submit" class="form-submit-button form-submit-button-simple_blue" onclick="checkFileFields();">

                  Send my application!

                </button>

    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.

    @flickenvy

    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.

    Thanks.

  • Profile Image

    Answered by barq on June 20, 2012 at 08:51 AM

    Thanks Jonathan,

    I tried to implement it here:

    http://barqvideo.com/wp-content/themes/barq_v3/barq_application/barq_application.html

    But unfortunately it still sends me all the content. I think I have inserted it correctly?

  • Profile Image
    JotForm Support

    Answered by jonathan on June 20, 2012 at 09:01 AM

    Hi Anders,

    Truly sorry., I missed to inform you.. in the code, please change the form ID# to yours (21703123301333  in your test web page)

     

     

    Please update.

    Thanks.

  • Profile Image

    Answered by barq on June 20, 2012 at 09:10 AM

    Hi Jonathan,

    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

    Aders

  • Profile Image
    JotForm Support

    Answered by jonathan on June 20, 2012 at 09:14 AM

    All the best Anders. =) JotForm team is glad to be of service as always.

    Thanks!

  • Profile Image

    Answered by jaycw7 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?

    Thanks

  • Profile Image
    JotForm Support

    Answered by idarktech on August 29, 2012 at 03:38 AM

    @jaycw7,

    Unfortunately, there's no direct solution for this. Our form builder doesn't have this option at this moment.

    What you can do for now is to embed your form using source code and then add the following codes at the top part of your form source code replacing the bolded numbers to your FORM ID.

    <script type="text/javascript">

    function checkFileFields()  

    {  

       //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  

          {  

             toDeleteElements.push(formElements[x]);  

          }

          }

       }  

       for (x in toDeleteElements)  

       {  

          //remove element from its own parent  

          toDeleteElements[x].parentNode.removeChild(toDeleteElements[x]);  

       }  

    }  

    </script>   

    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.

  • Profile Image
    JotForm Support

    Answered by kenneth on March 23, 2013 at 04:47 AM

    Hi,

    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.

    Thank you,
    Kenneth 

  • Profile Image

    Answered by mjgroup on June 13, 2016 at 12:26 PM

    Hi Kenneth,

     

    I don't have this option in my preferences? And am receiving all unused fields in submission emails?

     

    Or is it this?

     

    Clear Hidden Field Values

    -Clear on being hidden

    -Clear on submit

    - Don't clear

     

    Thanks

  • Profile Image
    JotForm Support

    Answered by BJoanna on June 13, 2016 at 01:38 PM

    @mjgroup

    I have moved your question to separate thread and we will provide you an answer there shortly. 

    http://www.jotform.com/answers/859571