Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Move the labeling of the field?

Questions related to using nuBuilder Forte.
Olikun
Posts: 68
Joined: Tue Mar 09, 2021 6:45 pm

Move the labeling of the field?

Unread post 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
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Move the labeling of the field?

Unread post by kev1n »

Code: Select all

$('#your_object_id').nuLabelOnTop()
Olikun
Posts: 68
Joined: Tue Mar 09, 2021 6:45 pm

Re: Move the labeling of the field?

Unread post 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
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Move the labeling of the field?

Unread post 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.
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Move the labeling of the field?

Unread post by kev1n »

It goes in the form's Custom Code.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Move the labeling of the field?

Unread post by kev1n »

@Janusz: v4.5. includes the function nuLabelOnTop()
Olikun
Posts: 68
Joined: Tue Mar 09, 2021 6:45 pm

Re: Move the labeling of the field?

Unread post 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.
Olikun
Posts: 68
Joined: Tue Mar 09, 2021 6:45 pm

Re: Move the labeling of the field?

Unread post by Olikun »

Hi,

I have another question on the same subject.

There is always a line break.

How can I change this?

Image
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Move the labeling of the field?

Unread post by kev1n »

Increase the label width.
Olikun
Posts: 68
Joined: Tue Mar 09, 2021 6:45 pm

Re: Move the labeling of the field?

Unread post by Olikun »

I tried that first, but nothing changes
does it have something to do with Janusz's code?

Image
Post Reply