I have a group of textbox on which I configured an autoNumeric (this plugin: https://github.com/autoNumeric/autoNumeric ):
$("input[name$='something']").autoNumeric('init', {aSep: '.', aDec: ',', aSign: ' €', vMax: '99999999999.9999'});
When I post my form I want to reformat the values on the textbox:
function parseBeforeSubmit() {
$("input[name$='something']").val(function(){
var myText = $(this)[0];
return myText.autoNumeric('get');
});
}
obviously I cant get it working, what I'm seeing is that myText has a property called jQuery36000058939066319538821 which contains autoNumeric, but it seems strange that I can't dynamically access the autoNumeric component and also it seems this autoNumeric component doesn't contains the unformatted numeric value.
Sure there's something I'm missing or maybe I used the wrong approach?
First and foremost, the call you are doing in your example are for
v1.9.*
, which is deprecated. If you can, you should use the latest version4.6.0
, which is much more user friendly, and have no jQuery dependency.If you want to modify the form input value before submitting, take a look at the specific form functions in the official documentation.
Perhaps you'll need
formNumericString()
,formArrayNumericString()
orformJsonNumericString
, depending of your exact need.