Adding Javascript to Sonic Forms

Updated on

Javascript is quickly becoming a standard for many websites and is used to improve the interactivity of your Sonic Forms. Javascript can do things like:
  • Make a field appear or disappear based on something else on a page.
  • Perform immediate calculations (e.g. work out a membership fee based on options selected).
  • Provide advanced validation checks based on the contents of more than one field (i.e. If field “A” is yellow then Fruit must be “Banana” or “Mango”).
  • And much more.

How To Add JavaScript To Your Form

Step 1

Access the menu Rise -> Page Builder -> Manage Content.

Step 2 

Select the folder. Then select the Web Content where you want to add JavaScript. Then click on "Edit".


Step 3

Click on the link “Add content”.

Step 4

Select “Content HTML”. Make sure that you are in the Folder “Content Types”.

Step 5 

In the field “Name” write(1) the name of your Form. Click(2) on the HTML Viewer. Then Write(3) your code in JavaScript. Remember to tag <script> to open and </script> to close. When you're done, click on the “OK” button.

Step 6 

View the content that you created. Publish your website.


Step 7

Test the script by accessing the page to see the message.