and change the description item to the read only mode, then the page will look a lot different and will be hard to control:
In such cases you can help yourself in different ways. Using some css or jQuery, you can make those read only items to appear only slightly different. For example, I used this code to change the layout of the description item on page load:
$('#P3_BP_DESC_DISPLAY').attr("readonly","readonly").css({"font-weight":"bold","color":"#ccc","display":"block","width":"240px"
,"height":"120px","overflow-y":"auto","border":"1px solid grey"})
and the result looked like this:
There are also some other more generic methods:
.display_only {font-weight:bold; color: #ccc; display: block; width: 200px}
$('[id*=_DISPLAY]').css({"font-weight":"bold","color":"#ccc","display":"block","width":"200px"})
$('.display_only').css({"font-weight":"bold","color":"#ccc","display":"block","width":"200px"})
The only thing you need to note is that setting an item to the read only mode will create two page elements. The displayed element will get the suffix _DISPLAY added to the corresponding item ID.
Enjoy.
1 comment:
Hi Denes,
I used your code on a rich text editor, it's working fine, but ... I loose all the formatting, the control shows now all the text in bold (after I deleted the "font-weight":"bold","color":"#ccc" part.), the text is nevertheless showed in bold.
I wonder if we can do something for keeping the format as it is.
Thank you.
Post a Comment