Use the WS Form shortcode to add a form to any page or post within WordPress.
The format of the WS Form shortcode is very simple:
[ws_form id="123"]
… where 123 is equal to your form ID.
The shortcode also has an optional element_id
attribute which enables you to set the element ID of the form. For example:
[ws_form id="123" element_id="my-form"]
This is useful if you want to target your form using JavaScript with a specific ID.
Learn more: HTML Form Attributes
Shortcode Field Population
You can populate fields when using a shortcode by using the following attributes:
Attribute: field_<field_id>
Use the field_<field_id>
parameter to set the value of a specific field ID., for example:
[ws_form id="123" field_1="Text value"]
In this example the field with the ID of 1 would be set to “Text value” by default.
You can also specify multiple field values, for example:
[ws_form id="123" field_1="Text value" field_2="Another value"]
To populate fields that have multiple values such as a checkbox field, you can separate values with a comma.
[ws_form id="123" field_1="Option 1,Option 2"]
Attribute: field_values
The field_values
attribute allows you to specifying field values in a query string format, for example:
[ws_form id="123" field_values="field_1=Text+Value&field_2=Another+Value"]