Welcome to the nuBuilder Forums!

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

Decimal comma & nuDebug() Entries

Questions related to using nuBuilder Forte.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Decimal comma & nuDebug() Entries

Unread post by toms »

Not in the subform but you can add it in the parent form.
ahernandez
Posts: 49
Joined: Thu May 03, 2018 12:08 pm

Re: Decimal comma & nuDebug() Entries

Unread post by ahernandez »

I tried this but doesn't works...

var x = document.getElementsByClassName("input_nuNumber nuNumber nuEdit");
var i;
for (i = 0; i < x.length; i++) {
$fieldname = x.id;
$($fieldname).attr('onchange','').on('blur', function(event) {
$(this).val($('#nuNumber').val().replace(',','.'));
nuChange(event);
});
}
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Decimal comma & nuDebug() Entries

Unread post by toms »

It's easier with the nuSubformObject() function:

Code: Select all

function fixCommas(frm, field)
var sf = nuSubformObject(frm);
for (var i = 0; i < sf.rows.length; i++) {
    $('#' + frm + nuPad3(i) + field).attr('onchange', '').on('blur', function (event) {
        $(this).val($(this).val().replace(',', '.'));
        nuChange(event);
    });
}
Example:

Code: Select all

fixCommas('yoursubformid','youfieldid');
ahernandez
Posts: 49
Joined: Thu May 03, 2018 12:08 pm

Re: Decimal comma & nuDebug() Entries

Unread post by ahernandez »

I'm trying to understand...

This code is to enter in JS code of the Form?

function fixCommas(frm, field)
var sf = nuSubformObject(frm);
for (var i = 0; i < sf.rows.length; i++) {
$('#' + frm + nuPad3(i) + field).attr('onchange', '').on('blur', function (event) {
$(this).val($(this).val().replace(',', '.'));
nuChange(event);
});
}

and where I have to put the call to this function?
ahernandez
Posts: 49
Joined: Thu May 03, 2018 12:08 pm

Re: Decimal comma & nuDebug() Entries

Unread post by ahernandez »

What is this function??
nuPad3(i)

I can't find it in the documentation...
ahernandez
Posts: 49
Joined: Thu May 03, 2018 12:08 pm

Re: Decimal comma & nuDebug() Entries

Unread post by ahernandez »

Ok

Forget my last post...

I have put this code in JS Code of the Form

function fixCommas(frm, field)
var sf = nuSubformObject(frm);
for (var i = 0; i < sf.rows.length; i++) {
$('#' + frm + nuPad3(i) + field).attr('onchange', '').on('blur', function (event) {
$(this).val($(this).val().replace(',', '.'));
nuChange(event);
});
}

And this one in the 'onchange' event of the subform field
fixCommas('yoursubformid','youfieldid');

It executes the function fixCommas getting the right values for frm, field and sf variables, but it doesn't change the field value replacing the '.' by ','

I apologize for the inconvenience toms.
ahernandez
Posts: 49
Joined: Thu May 03, 2018 12:08 pm

Re: Decimal comma & nuDebug() Entries

Unread post by ahernandez »

Hello!!

Again forget everything I said.
I had mis indicated the name of the subform.
Now it works correctly.

I'm very grateful toms!
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Decimal comma & nuDebug() Entries

Unread post by toms »

Don't forget to apply the fix if new rows are added.
ahernandez
Posts: 49
Joined: Thu May 03, 2018 12:08 pm

Re: Decimal comma & nuDebug() Entries

Unread post by ahernandez »

I have made these changes on subform field... including two events, onchange & onblur
Captura de pantalla 2018-05-26 a las 16.55.26.png
is it ok?
You do not have the required permissions to view the files attached to this post.
ahernandez
Posts: 49
Joined: Thu May 03, 2018 12:08 pm

Re: Decimal comma & nuDebug() Entries

Unread post by ahernandez »

Excuse me..

These are the changes I've made.. but I think this is not the best place to put it, isn't it?

The function fixCommas() is in the Form JS Code.
Captura de pantalla 2018-05-26 a las 17.06.03.png
You do not have the required permissions to view the files attached to this post.
Post Reply