MCPcopy
hub / github.com/autoNumeric/autoNumeric / formSubmitLocalized

Method formSubmitLocalized

src/AutoNumeric.js:3405–3417  ·  view source on GitHub ↗

* Convert the input values to localized strings, submit the form, then reformat those back. * The function can either take a callback, or not. If it doesn't, the default `form.submit()` function will be called. * Otherwise, it runs `callback(value)` with `value` being equal to the result o

(forcedOutputFormat = null, callback = null)

Source from the content-addressed store, hash-verified

3403 * @returns {AutoNumeric}
3404 */
3405 formSubmitLocalized(forcedOutputFormat = null, callback = null) { //FIXME test this
3406 if (AutoNumericHelper.isNull(callback)) {
3407 this.formUnformatLocalized();
3408 this.form().submit();
3409 this.formReformat();
3410 } else if (AutoNumericHelper.isFunction(callback)) {
3411 callback(this.formLocalized(forcedOutputFormat));
3412 } else {
3413 AutoNumericHelper.throwError(`The given callback is not a function.`);
3414 }
3415
3416 return this;
3417 }
3418
3419 /**
3420 * Generate an array of numeric strings from the `<input>` elements, and pass it to the given callback.

Callers 1

Calls 7

formUnformatLocalizedMethod · 0.95
formMethod · 0.95
formReformatMethod · 0.95
formLocalizedMethod · 0.95
isNullMethod · 0.80
isFunctionMethod · 0.80
throwErrorMethod · 0.80

Tested by

no test coverage detected