# Form Designer: How to ensure custom client-side JavaScript code is executed at runtime only

**URL:** <https://discuss.workflowgen.com/t/form-designer-how-to-ensure-custom-client-side-javascript-code-is-executed-at-runtime-only/294>\
**Category:** Form Designer\
**Created:** [January 7, 2016, 2:48am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-ensure-custom-client-side-javascript-code-is-executed-at-runtime-only/294 "2016-01-07T02:48:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [January 7, 2016, 2:48am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-ensure-custom-client-side-javascript-code-is-executed-at-runtime-only/294/1 "2016-01-07T02:48:39Z")

</div>

To ensure that your custom client-side JavaScript code is executed in runtime mode only, enclose your JavaScript code with the following IF block:

```auto
if (typeof $selectedObject === "undefined") {
 // Place your code here 
}

```
