How to set number validation with commas and decimal
-
- Posts: 22
- Joined: Tue Sep 05, 2017
Hi All,
I have "number" columns in my spforms form, i want to restrict the number upto one decimal and put commas every three digits like 1,231,789.9
Any suggestions please
I have "number" columns in my spforms form, i want to restrict the number upto one decimal and put commas every three digits like 1,231,789.9
Any suggestions please
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello!
You can try a number formatting plug-in. For instance, this one:
https://github.com/customd/jquery-number
You can try a number formatting plug-in. For instance, this one:
https://github.com/customd/jquery-number
Cheers
-
- Posts: 22
- Joined: Tue Sep 05, 2017
Hi Nikita,
I didn't understand anything over there, there are many files as well. Would you please help me.
Thanks
Ram
I didn't understand anything over there, there are many files as well. Would you please help me.
Thanks
Ram
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Alright, there is nothing complicated, you just need to take these steps:
1) Go to GitHub page and download this plugin as zip file. On the page you can see green button that says Clone or Download, click it and select Download Zip: 2) You will download Zip archieve. You will need to unpack it and get the folder inside of it: 3) Now you need to upload this folder online, so you can get access to it on your Forms. I've uploaded mine to the default Documents folder on my site, you can do the same: 4) Next, on my Form, I gave CSS Class "number" to the fields I wanted to format: 5) Finally, I've added JavaScript to link uploaded files to the Form and format fields with class "number":
And here is the result:
Follow the steps closely and you'll be able to reproduce it.
1) Go to GitHub page and download this plugin as zip file. On the page you can see green button that says Clone or Download, click it and select Download Zip: 2) You will download Zip archieve. You will need to unpack it and get the folder inside of it: 3) Now you need to upload this folder online, so you can get access to it on your Forms. I've uploaded mine to the default Documents folder on my site, you can do the same: 4) Next, on my Form, I gave CSS Class "number" to the fields I wanted to format: 5) Finally, I've added JavaScript to link uploaded files to the Form and format fields with class "number":
Code: Select all
//set jQuery to global scale, so uploaded files can use it
window.$ = $;
window.jQuery = $;
//import uploaded files to the page
var imported = document.createElement('script');
//don't forget to change site url to your site name, shared documents is the default name of "Documents" folder
imported.src = '/sites/mysite/shared documents/jquery-number-master/jquery.number.js';
document.head.appendChild(imported);
//need a little time to load js file
setTimeout(function(){
$( ".number" ).find( "input" ).number( true, 1 );
}, 500);
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests