Webform Javascript Field

Component ID

2453029

Component name

Webform Javascript Field

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

676

Component created

Component changed

Component body

With Webform Javascript Field you can use custom JavaScript or jQuery snippets for all your Webform form elements.

Features

  • Use custom JavaScript code for all webform components.
  • Bundle your helper functions in a custom file and load them for the entire webform.


Requirements


Configuration

Edit your Webform components (e.g. node/[nid]/webform/components/[cid]) and add some JavaScript code that should be used in the field JavaScript Snippet. For example you can write a custom formatter and use it to format the input value:

jQuery("input[name='submitted[sphere]']").focusout(function() {
  trim_value(this);
  format_sph(this);
});

In addition, you can use a custom Javascript file which bundles all of your helper functions. All you have to do is entering the path to your file (e.g. sites/all/libraries/Calculation/js/formatter.js) on the node edit tab. Now you can simply call the desired function on the component edit page like described above.

Credits

The project has been sponsored by @culfin.