zeal zeal - 1 year ago 372
Javascript Question

autoNumeric.js remove formatting before submitting form

i'm using a jquery plugin -> AutoNumeric (http://www.decorplanit.com/plugin/) and when I submit the form i can't remove the formatting on the fields before POST.

I tried to use

(and other methods) but it leaves the formatting on the textfields.

How can I post the unformatted data to the server? How can i remove the formatting? Is there an attribute for it in the initial config, or somewhere else?

I don't want to send the serialized form data to the server (with ajax). I want to submit the form with the unformatted data like a normal html action.

Answer Source

I wrote a better, somewhat more general hack for this in jQuery

    var form = $(this);
        var self = $(this);
            var v = self.autoNumeric('get');
            console.log("Not an autonumeric field: " + self.attr("name"));
    return true;

This code cleans form w/ error handling on not autoNumeric values.