Page 1 of 2

Move the labeling of the field?

Posted: Fri Mar 12, 2021 7:32 pm
by Olikun
Hello,


I do good lectures with my project.

Thanks to all for the help


My current question

The labeling of a field is in front of the field.
Can I do it over it too?

Like on the picture?

Image

Re: Move the labeling of the field?

Posted: Fri Mar 12, 2021 7:54 pm
by kev1n

Code: Select all

$('#your_object_id').nuLabelOnTop()

Re: Move the labeling of the field?

Posted: Fri Mar 12, 2021 8:01 pm
by Olikun
wow again so fast.

but where do I have to enter this code?
In an HTML field? I tried it, but it doesn't work

Re: Move the labeling of the field?

Posted: Fri Mar 12, 2021 8:35 pm
by Janusz
Place that code: $('#your_object_id').nuLabelOnTop()
in the JS/Custome code of your Form.

IF you want for example to change all labels on your form together with css you can use following code as well:

Code: Select all

function custFieldLabelsOnTop(f, e) {
    for (var i = 0; i < f.length; i++) {
        if (jQuery.inArray(f[i], e) == -1) {
 
            var t = $('#' + f[i]).cssNumber("top");
            var l = $('#' + f[i]).cssNumber("left");
            $('#' + 'label_' + f[i]).css({
                'top': t - 18,
                'left': l - 15,
                'font-weight': 'bold',
                'color': '#3300FF',
                'font-size': '13px'
            });
        }
    }
}

if (nuFormType() == 'edit') {
    var f = nuSubformObject("").fields; // include all fields of your main form.
    custFieldLabelsOnTop(f, []);
}
Place it in the JS Custome code.
For a quick try - when on the form - open console (to open press F12) and copy paste that code to the console and you will see the result immediately.

Re: Move the labeling of the field?

Posted: Fri Mar 12, 2021 8:36 pm
by kev1n
It goes in the form's Custom Code.

Re: Move the labeling of the field?

Posted: Fri Mar 12, 2021 8:38 pm
by kev1n
@Janusz: v4.5. includes the function nuLabelOnTop()

Re: Move the labeling of the field?

Posted: Fri Mar 12, 2021 8:41 pm
by Olikun
Perfect. it works

thank you both :)

Janusz wrote:Place that code: $('#your_object_id').nuLabelOnTop()
in the JS/Custome code of your Form.

IF you want for example to change all labels on your form together with css you can use following code as well:

Code: Select all

function custFieldLabelsOnTop(f, e) {
    for (var i = 0; i < f.length; i++) {
        if (jQuery.inArray(f[i], e) == -1) {
 
            var t = $('#' + f[i]).cssNumber("top");
            var l = $('#' + f[i]).cssNumber("left");
            $('#' + 'label_' + f[i]).css({
                'top': t - 18,
                'left': l - 15,
                'font-weight': 'bold',
                'color': '#3300FF',
                'font-size': '13px'
            });
        }
    }
}

if (nuFormType() == 'edit') {
    var f = nuSubformObject("").fields; // include all fields of your main form.
    custFieldLabelsOnTop(f, []);
}
Place it in the JS Custome code.
For a quick try - when on the form - open console (to open press F12) and copy paste that code to the console and you will see the result immediately.
kev1n wrote:It goes in the form's Custom Code.

Re: Move the labeling of the field?

Posted: Wed Mar 24, 2021 7:49 pm
by Olikun
Hi,

I have another question on the same subject.

There is always a line break.

How can I change this?

Image

Re: Move the labeling of the field?

Posted: Wed Mar 24, 2021 8:04 pm
by kev1n
Increase the label width.

Re: Move the labeling of the field?

Posted: Wed Mar 24, 2021 8:11 pm
by Olikun
I tried that first, but nothing changes
does it have something to do with Janusz's code?

Image