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

Question

Question

CSS Issue in Forms works in layout, but not in Preview.

asked on July 13, 2023

I have added #q35 label {color: red!important;} in the CSS field of Modern Designer. I can see in the Layout view it is working as expected. However it is not working when I preview it? Why would this happen? I have also added a CSS class to some fields hoping that would work but it didn't. 

 

0 0

Answer

SELECTED ANSWER
replied on November 14, 2023

it does not work on form layout but should work fine on preview(see below), can you double check ?

0 0

Replies

replied on July 16, 2023

Hi, this is a known issue and we have already fixed. It is recommended to upgrade to the latest version: Forms Version 11 Update 4.wink

1 0
replied on July 19, 2023

I have installed the Laserfiche 11 update 4 and I am seeing the same behaivor

 

Design:

 

Preview:

0 0
replied on July 19, 2023

Thanks for reporting this issue, it seems like the css style cannot apply on the field inside the table. We have logged it as a bug (ID 473220), it will be fixed with the next Forms update. Apologies for the inconveniencecrying

0 0
replied on November 10, 2023 Show version history

After further research, I think it is expected behavior based on customize css 

 

Fields inside table use different attributes on form designer and renderer (by design),and the attribute (like #q1) only can be found on form designer, while not found on renderer, so the color won't be change when preview form

 

Should use attributes existing on renderer when set css, such as:

 .table-header-cell {color: red!important;}

0 0
replied on November 10, 2023

Hello @████████,

I tried that and it still does not work. Please see screenshot below. 

0 0
SELECTED ANSWER
replied on November 14, 2023

it does not work on form layout but should work fine on preview(see below), can you double check ?

0 0
replied on November 14, 2023

Hello @████████,

Yes thatnk worked, Thank you!

1 0
replied on July 13, 2023

Worked for me when I tested.

If you temporarily remove all the other CSS on your form (save it somewhere) so that it just has this one value - does it work?  I wonder if something else is conflicting with it.

I also wonder about line 6 in your screenshot where it just says q17 and not #q17 - I don't think that would be causing this issue - but probably is preventing that particular field from working as expected.

0 0
replied on July 14, 2023

Thank you for testing.

 

I removed all other CSS from my test form, and I am seeing the same behavior. 

 

This is a test form that I try different CSS on so I removed the # to ignore that line of CSS. Thank you or pointing that out, because that line will not work. 

0 0
replied on July 14, 2023 Show version history

Tip: I would use comment tags /*before and after*/ to ignore areas you want to exclude as you test.

What version are you on?

0 0
replied on July 14, 2023

I didn't realize before that you were looking at the field in the table.

I can actually replicate the bahavior you listed when I try it in a table.

There does appear to be a difference in how the table is rendered in the Layout screen versus how it is rendered in the running form (Preview).

This screenshot is from the running form (Preview) - you can see that a single line field has the q-id (q1 in this screenshot) as the id attribute assigned to a div element, and that a child/decendant below that is the label element, so the CSS works here.


And in the Layout view, on the table, you can see it also has a label element, and there is a reference to the q-id (q3 in this screenhot) as a "data-col" attribute on a div element a couple levels above the label.

But when we view the label from the table in the running form (Preview), we find that it is it's structured differently.  For one thing, it isn't a label element but rather a th element.  Additionally, I don't see the q-id (q3 in this example) listed anywhere linking that label back to the specific field.  I searched for the q-id in the inspector and only found it mentioned in my CSS and in the field itself, no where on the label.

I would argue this is a bug and not an intended behavior - and hopefully someone from Laserfiche will be able to verify and report back on a bug id if applicable.

The downside is, I don't think you are going to be able to make this work for specific field labels, because the th element in the table doesn't reference back to the specific field.  If you are okay with every label in the table having the CSS applied, you can do this: 

.table-header-cell {color: red!important;}

 

0 0
replied on July 14, 2023

Thank you for looking into this and finding root cause to the issue. 

 

I don't think I am going to be able to get this to work either because my client would prefer only this field label to be red. 

 

Also - Thank you for the tip for /* before and after when I don't want to use code for testing. 

1 0
replied on July 14, 2023

You're welcome.

/*And comments are just helpful because if you add comments 
to your code and your future self will thank you.*/

 

0 0
replied on July 14, 2023

What version of Forms are you using?

0 0
replied on July 14, 2023

I am using 11.0.2212.30987

0 0
replied on July 14, 2023

Ugh - so am I - so that doesn’t explain the difference in behavior.  sad

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

Sign in to reply to this post.