Skip to main content

For Anyone interested in changing the background color of all VIEWS, which helps users find input fields, this is how I discovered it could be done:

1. Add a label called “hdn Javascript Change View Background Color” to the form
2. Set the text of the new label to
<script type="text/javascript">$(document).ready(function() {$('.panel-body').css('background','#e5e5e5);})</script>

The label is invisible to the user.  Change #e5e5e5 to a color of your choice.  Works for all Smart Forms with Views.

 

16967iC0DD2A400CF60173.jpg

Hi JoeWright,


 


I have tried your suggestion multiple times, this does not seem to work.


 


Taken Steps:


1. Create a view with a text box.


2. Generate a form from the view


3. Add a label to the form and set the Name property to - hdn Javascript Change View Background Color


4. Set the labels Text property to - <script type="text/javascript">$(document).ready(function() {$('.panel-body').css('background','#e5e5e5);})</script>


5. Change " #e5e5e5 " colour to any colour of choice.


(I tried leaving the colour as is "#e5e5e5" which is a light grey and I also tried changing the colour to multiple different colours.)


6. With all these steps No difference was brought by in my view or form.


 


I tested this both ways, by adding the label to the form with the specified Name and Text properties which did not make any change to my view or form in design time nor runtime. I also tried the same scenario but instead of on the form i tried it on the view which also made no difference to the view or form.


 


The only outcome that I received was not one that i was hoping for. After all your step were followed, I edit the form again which immediately goes into a load loop. But the weird part of all is am still able to open other views and form in edit mode while it is stuck in the load loop I however cannot make changes to the view or form but i can see that the view or form is opened behind the load loop indicator. (Please see attached screenshot).


Solution - When this happens K2 Designer has to be reloaded in order for designer to function properly again.


 


14199i7A831402C97AA976.png

 


FYI - The label looks as if it had disappeared but it did not, because html code was inserted into the text property the label picks it up as no text (a label is resized according to its contained text) meaning that the label will be resized to the smallest size if it has no text. It would look as if it had disappeared but it is still present on the viewform, giving the label a border from the styles property before adding " <script type="text/javascript">$(document).ready(function() {$('.panel-body').css('background','#e5e5e5);})</script> " into the Text property, while creating the label will prove my point (Please see attached screenshot).


 


11260i0B8BC6363196ABA2.png

I noticed that you have the same posting posted on a different post labelled "Re: Change backgroud color of a cell in a table control "


http://community.k2.com/t5/K2-blackpearl/Change-backgroud-color-of-a-cell-in-a-table-control/m-p/73499#U73499




Please advise...


 


Kind Regards,


Raymond


It reall was a different subject so I reposted it here.  


Reply