Webanizr Logo
Open / sluit menu
Module formValues

Last change: July 10, 2020

Current version: 1.11.7

The formValues module collects all values from the given form. The module is triggered by the onsubmit of the form. The formValues module blocks the normal submission of the form. Posting the data should therefore happen in the callback function.

syntax

webanizr.collect('formValues', parameters, callback);

parameters

The formValues module accepts the following parameters:

id__form (required)

The html id of the form from which the values should be collected.

direct__collect (optional)

If this parameter is set to true, the module does not wait for the onsubmit but collects the values direct when called. This option can be used when the onsubmit is triggered elsewhere and this module is then used to collect the formvalues on that moment.

labels__values (optional)

If set to true, not only the values, but also the labels of selects and radio fields will be collected. The label text will be stored with as key "label" + fieldname.

text__processing (optional)

Sets submit button's text value as given text. If duration__processing is given, sets the submit button text for that amount of duration then resets the text of submit button. Otherwise, sets the text and never resets.

duration__processing (optional)

If set, sets the submit button text for that amount of duration then resets the text of submit button. The duration is in milliseconds.

text__bottom (optional)

Sets a feedback message after submitting the form. The text appears at the bottom of the submit button and dissappears after 5 seconds.

translate__submitfeedback (optional)

If set to true, the feedback message(text value of text__bottom parameter) after submitting the form will be translated.

callback

The callback is called when the form is submitted and the values are collected. The callback receives the form values als parameter.

demo

Collecting form values:

https://cdn.cpmodules.webanizr.com/demo/collect-form-values/index.html

Feedback text on click submit form button:

https://cdn.cpmodules.webanizr.com/demo/feedback-submit-button/index.html

Translate submit form feedback message:

https://cdn.cpmodules.webanizr.com/demo/translations/index.html

Changelog

  • July 10, 2020: 1.11.8 - Remove test console.log
  • July 10, 2020: 1.11.7 - Support for existing values in file fields
  • July 7, 2020: 1.11.5 - Fixed a typo
  • July 7, 2020: 1.11.4 - Files are now also excepted when not using the FormData options, support for the draganddrop field in buildForm added
  • April 10, 2020, 1.11.2 - fixed the "undefined" text after clicking submit form button
  • November ?, 2019, 1.11.1 - ??
  • November 8, 2019, 1.11.0 - Added optional translate__submitfeedback parameter for translating submit form feedback message
  • November 6, 2019, 1.10.1 - fix for labels__values parameters
  • November 5, 2019, 1.10.0 - added optional feedback on submitting the form
  • November 1, 2019, 1.9.0 - added text__processing, text__bottom and duration__processing parameters
  • November 1, 2019, 1.8.0 - added labels__values parameter
  • October 23, 2019: 1.7.1 - values of HTML5 date fields are now collected
  • ?: 1.7.0 - ?
  • September 2, 2019: 1.6.4 - fixed data retreival for Internet Explorer 11