Solved

Number format in Nintex forms

  • 28 July 2017
  • 5 replies
  • 258 views

Badge +4

Hi everyone, how are you?

I'm having a very technical difficulty with Nintex and SharePoint 365. We have a SharePoint List, with many "number" fields on it. The problem is that we need to limit the range for those fields in the form. This may seem simple enough, using SharePoint like in the image bellow:

206037_pastedImage_1.png

The problem is that we use these forms in Brazil, which means that the comma (",") is used as a decimal separator. The date is also set as DD-MM-YYYY. So our SharePoint format is correctly defined for "Portuguese (Brazil)" in regional settings, and for that, we need to use commas when defining ranges, like in the image above. The problem is that these settings apparently conflict with Nintex. This ranges do not work on Nintex Forms, as we think that Nintex uses points (".") as decimal separators.

Is there anyway to overcome this problem? Like, is there a way to change decimal number format on Nintex? We thought about creating individual validation rules for each of the form fields, but that seems unnecessary, as SharePoint should already provide this functionality.

Regards, Igor.

icon

Best answer by sean_fiene 2 August 2017, 03:59

View original

5 replies

Badge +9

Hi Igor,

Great question! 

I have been looking at using the Intl.NumberFormat object to achieve this in Nintex Forms: Intl.NumberFormat Object (JavaScript) | Microsoft Docs 

Testing this within the Developer console of the browser, I was able to get a desired result. I believe you will just need to replace the value to format against in the code below as the .val() of the input control:

var nf = new Intl.NumberFormat(["pt-br"], {
minimumFractionDigits: 3
});

console.log(nf.format(INPUT VALUE HERE));‍‍‍‍‍

You will also need to add some more options to set the max value for the control, but this should be a decent start. 

Thank you,

Sean 

Badge +4

Hi Sean, thanks a lot for the help!

But I'm sorry, but is there anyway to implement it on Nintex? I know we can log it into the browser console, but how can we use it on Nintex?

Regards, Igor.

Badge +9

Hi Igor,

No worries, sorry about not including mapping the values to the control. 

If you have a single line text box, add the JavaScript Client ID of 'txtCur'.

From there you can take the value of that control and write back the proper locale using the following JavaScript:

NWF$(document).ready(function () {

    var nf = Intl.NumberFormat(["pt-br"], {
        minimumFractionDigits: 3
    });


    NWF$('#' + txtCur).change(function () {
        var chngVal = NWF$('#' + txtCur).val();
        console.log("chngVal = " + chngVal);
        var l = nf.format(chngVal);
        console.log("var l = " + l);
        NWF$('#' + txtCur).val(l);       
    });
});

Thank you,

Sean Fiene

Badge +4

Hi Sean, thanks a lot, it really worked here!

Regards, Igor!

Badge +4

Hi Sean! This solution worked perfectly! But do you know how could I achieve this using the Nintex Mobile Layout for iPad? Because in this case, the iPad only accepts commas as a decimal separator, but when data goes to SharePoint, it ignores the commas.

Regards, Igor!

Reply