Skip to main content

Embed Web-Form in Layout

You can call any web-form in layout using following code sample:

<block type="webforms/webforms" name="my_block_name" template="webforms/default.phtml">
<action method="setData">
<key>webform_id</key>
<value>1</value>
</action>
</block>

Layout assets

Though in most cases WebForms tries to auto-load all required libraries, you may need to include following assets in your layout handle:

<reference name="head">

<!-- Default -->
<action method="addCss">
<stylesheet>webforms/form.css</stylesheet>
</action>
<action method="addCss">
<stylesheet>webforms/results.css</stylesheet>
</action>

<!-- Auto-complete -->
<action method="addJs">
<js>webforms/auto-complete/auto-complete.min.js</js>
</action>
<action method="addCss">
<stylesheet>webforms/auto-complete.css</stylesheet>
</action>

<!-- Logic -->
<action method="addJs">
<js>webforms/logic.js</js>
</action>

<!-- Dropzone -->
<action method="addJs">
<js>webforms/dropzone.js</js>
</action>

<!-- Tooltip -->
<action method="addJs">
<js>webforms/opentip/opentip-native-excanvas.min.js</js>
</action>
<action method="addItem">
<type>js_css</type>
<name>webforms/opentip/opentip.css</name>
</action>

<!-- Multistep template -->
<action method="addJs">
<js>webforms/multistep.js</js>
</action>

<!-- Star Rating -->
<action method="addCss">
<stylesheet>webforms/stars.css</stylesheet>
</action>
<action method="addJs">
<js>webforms/stars.js</js>
</action>

<!-- Date Picker -->
<action method="addItem">
<type>js_css</type>
<name>calendar/calendar-blue.css</name>
</action>
<action method="addJs">
<js>calendar/calendar.js</js>
</action>
<action method="addJs">
<js>calendar/calendar-setup.js</js>
</action>

<!-- Ajax Submission Popup Windows -->
<action method="addJs">
<js>prototype/window.js</js>
</action>
<action method="addItem">
<type>js_css</type>
<name>prototype/windows/themes/default.css</name>
</action>
<action method="addItem">
<type>js_css</type>
<name>prototype/windows/themes/alphacube.css</name>
</action>

<!-- HTML Editor -->
<action method="addJs">
<js>tiny_mce/tiny_mce.js</js>
</action>

</reference>

<reference name="content">

<!-- Date Picker Block -->
<block type="core/html_calendar" name="head.calendar" as="calendar" template="page/js/calendar.phtml"/>

<!-- HTML Editor Block -->
<block type="core/template" name="tiny_mce.init" template="webforms/scripts/tiny_mce.phtml"/>

</reference>