I created a field that will hold a numeric database value to do additional lookups based on it's value. After making sure the number populates correctly I want to hide the field. I was going to create a CSS class named hide to perform this. I have not yet created the class, but if I go to the advanced tab of the field and type in hide in the CSS Class field, the field disappears completely. The attribute still exists. If I pull up a Preview the field shows. Any ideas what's going on?
Question
Question
Why does a field disappear from the Edit page when its CSS class is set to hide?
Answer
Please see the "hiding fields" section of this page in the help. Specifically, check out the warning message there for more information. Forms already defines the hide and hidden css classes.
Just as an FYI, the warning box you mention has the same block of text pasted in twice.
The blocks of text are similar; the first deals with the hide class and the second deals with the hidden class.
Ha! So it does. :)
In the new Forms designer, I accidentally used the "hidden" class, before reading this warning. However, the warning says that using the "hidden" class would hide the form on both the Form and in the Forms Designer. This was not the case for me. When I used the "hidden" class, it was hidden in the Forms designer, but NOT in the Form itself.
I was able to get go into the Console per the instructions and remove the class from Chrome, but in the new Forms Designer, instead of $('li.hidden').removeClass('hidden'); you have to use the div tag instead of the li tag for a single line text field. $('div.hidden').removeClass('hidden');
So, my assumption is that if we want to hide a field from the Form and not the Forms Designer, we have to create a custom CSS class (named something like "dontShow") rather than using the predefined "hide" or "hidden" classes and then create the CSS to manually hide it?
So, creating the custom CSS class and setting the display:none will hide it from the Forms Designer AND the Form itself. If you want to see the field in Forms designer, you have to manually update the CSS class to display:show and remember to switch it back before you view the Form.
@████████ This just happened to me too. First time really using the new forms designer. In the old one, you could use the 'hidden' class and still interact with the field in the designer. Since I typed in hidden, the field is gone from the designer and shows during the preview. This doesn't make any sense to me. Did Laserfiche ever have an answer to this bug?
@Lucas Large I haven't gotten a response on whether this was a bug or just how the new Forms Designer was built. Their documentations says that "hide" and "hidden" were supposed to work differently. But, in my experience they both hid the field from both the Form and the Designer. The only way I could get it to show was to execute that removeClass command from the console. As a work around, I just created a custom class and assigned it to the field. In the CSS, I can simply set it to "show" or "hide" as needed, without having to do it in the console.
Replies
I would recommend against using the "hide" or "hidden" CSS classes altogether and instead create your own CSS class that hides the fields from your form. When you use the built in classes you have no control over any changes that Laserfiche may make in the future to those classes.