You are viewing limited content. For full access, please sign in.

Question

Question

Hide all Blank/Null fields

asked on August 4, 2016 Show version history

Hello,

I have an application form that users complete. Using Javascript and CSS section, some of the fields on the form are hidden and only displayed for completion based on certain criterias being met. I am then saving the form to Laserfiche repository.

The issue is that when the form is submitted, the originally hidden fields on the form are once again hidden, thus, when the form is saved, it only shows the fields that were not originally hidden using JS. I have created a workaround by making a copy of the original form, removing all the JS, then saving the copy in my save to repository task. Problem is, now ALL fields are shown on the saved file which some have nothing to do with the application type the user selected.

I would like to save in the repository file, all the fields that were completed (or not blank).

How do I write this in Javascript to hide all blank fields after the form is submitted?

 

0 0

Replies

replied on August 4, 2016

I guess the issue is that your custom script is not properly designed to get value on a read-only form. You may check the submitted form from instances page, which is also a read-only form, see if the field shows correctly and update corresponding scripts.

Besides, why not use field rule to show/hide the field? It's easy to use and works correctly on read-only form.

0 0
replied on August 8, 2016

Hello Rui,

The values from my original form is showing both on the submitted instance and also on the copy.

My problem is that the fields themselves don't show on the form once submitted because they are "hidden". The only reason i created a copy of the form (read only) is to un-hide all fields so i can see all the fields that were completed on the submitted form whether hidden or not. 

Field rules is unable to accomplish what i am trying to do with the scripts on the original form. I cant use it on the copied form (read only), because i wont know what fields would have been completed since each application is different. I would have to put a field rule on every field.

I just need some help to create a JS that can identify all blank fields in the form. This way i could try to check all fields in the form and only show the fields that are not blank on submittal or on my read only form.

0 0
replied on August 8, 2016 Show version history

The script would depend on which kind of fields you used on the form.

Here is an example that could hide single line/multi-line fields on a read-only form:

$(document).ready(function(){
  $('.cf-field').each(function(index){
    if ($(this).text() === '')
    {
      $(this).closest('li').hide();
    }
  });
})

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.