MCPcopy
hub / github.com/autoNumeric/autoNumeric / formSubmitNumericString

Method formSubmitNumericString

src/AutoNumeric.js:3362–3374  ·  view source on GitHub ↗

* Convert the input values to numeric 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 of

(callback = null)

Source from the content-addressed store, hash-verified

3360 * @returns {AutoNumeric}
3361 */
3362 formSubmitNumericString(callback = null) { //FIXME test this
3363 if (AutoNumericHelper.isNull(callback)) {
3364 this.formUnformat();
3365 this.form().submit();
3366 this.formReformat();
3367 } else if (AutoNumericHelper.isFunction(callback)) {
3368 callback(this.formNumericString());
3369 } else {
3370 AutoNumericHelper.throwError(`The given callback is not a function.`);
3371 }
3372
3373 return this;
3374 }
3375
3376 /**
3377 * Submit the form with the current formatted values.

Callers 1

Calls 7

formUnformatMethod · 0.95
formMethod · 0.95
formReformatMethod · 0.95
formNumericStringMethod · 0.95
isNullMethod · 0.80
isFunctionMethod · 0.80
throwErrorMethod · 0.80

Tested by

no test coverage detected