Celebrate WordCamp Asia 2024 with 30% OFF! Use coupon WC30 - Terms

Run JavaScriptPRO

The Run JavaScript action allows you to run any JavaScript when a form is saved or submitted.

Adding This Action

To add a Run JavaScript action:

  1. When editing your form, click the Actions icon at the top of the page. The Actions sidebar will open on the right-hand side of the page.
  2. Click the Add  icon to add a new action.
  3. Select JavaScript from the Action pulldown. A series of settings will appear.

As with all sidebars in WS Form, click the Save button at the bottom to save your changes, or click Cancel to disregard your changes.

The Run WordPress Hooks action settings are as follows:

When Should This Action Run?

You can choose to run the WordPress hook when the form is saved, submitted, or both.

JavaScript

Enter the JavaScript you would like to run in the editor.

For example:

alert('Thank you for submitting your form, #user_first_name!');

You can enter straight text or use a WS Form variable in the JavaScript. For more information about WS Form variables, click here.