Use a font family in multiline text field

Hi,

Is it possible to use the "Courier New" non-proportional font family in a multiline text field.
I would like to align text using spaces rather then creating tables.

Pieter

Hello @Pieter,

You can do that using the code:

fd.rendered(() => {
    fd.field('Note1').widget.document.body.style.fontFamily = 'Courier New';
})

Thanks for your answer but it doesn't seem to work in my case.
I also tried removing the => because I've never that in a code but it doesn't make a difference.

image
image

Hello @Pieter,

Please try adding the ready event like so:

fd.rendered(() => {
    fd.field('Note1').ready().then((field) => {
        field.widget.document.body.style.fontFamily = 'Courier New';
    });
})

Good morning,

Thanks for your response. It works, but only in edit mode.
In display mode it is still using a proportional font.

image

Hello @Pieter,

Since on the Display form, the content of the field is not inside the input, but is a plain text, you can use this code:

$(fd.field('Note1').$el).css('font-family', "Courier New")

Good morning,

It's all working now. You can close the topic as resolved.
As always, thanks for your support...

Pieter

1 Like