Text align in read only field form?

eduzol
Tera Contributor

Hi Team,

I have been trying to align text to the right in a read only (or disabled) field.

find_real_file.png

Following script works with active fields, but it does not work for read-only fields:

function onLoad() {

var el = g_form.getControl('volume');

el.style.textAlign='center'; //DOM manipulation

}

Also tried other approaches with no luck:

$j('#fieldId').css("text-align" ,"right");

Note: This style is for Form only. List format is OK.

Please help.

Thank you,

Regards.

7 REPLIES 7

nitin_kumar
Mega Guru

Hi Eduardo,



I think field styles are the best way to achieve this requirement. Check this link for reference.



Thanks,


Nitin.



Hit Like, Helpful or Correct based in the impact of the response


Hi nitin_kumar thank you for following up.


I took a   look at the resource that you shared.


We want to apply two different styles, one for Forms (text align right) and one for lists (text align center) .



Is it possible to create one field style for form and one for list view? Please advise



Thank you again,


Regards.


David Casper
Tera Guru

Were you able to figure this out?

Swapnil Soni1
Giga Guru

Hey eduzol,

You can simply navigate to System UI > Field Styles > New   Create new style for which field you want to change text alignment and enter style in that style table.

For Ex- if I want to change the caller field text alignment on incident table then i have to create new field style .Take table name as incident , field name as Caller ,value as javascript:1=1,and style as 

text-align:right 

Try this once and If my answer is helpful then please  mark it as helpful and correct.

 

Thanks