Evolv Forms - On Load Code Workaroud

/* **************************************************************************** Evolv won't let us add javascript functions to a form's [After Load Code] field. The following is a WORKAROUND for this limitation. + The anonymous function uses a variable to trigger the [OnChange] event on the form. + The additional line of code removes the anonymous function from the form's XML in order to avoid an XSLT error. + The anonymous function's curly braces are doubled on purpose to avoid an XSLT error. How to use: - Create a variable named [on_load_code] of type {Boolean} - Paste the following code on the [On Load Script] field of the [on_load_code] variable - Add the code you want executed to the [On Change Script] field of the [on_load_code] variable **************************************************************************** */ window.setTimeout(function () {{ var cfs_code = getFormElementDOM('on_load_code'); getFormElementDOM('caption_on_load_code').style.display = 'none'; setFormElement('on_load_code', 'Run Code'); cfs_code.focus(); cfs_code.blur(); cfs_code.style.display = 'none'; }} , 1000); /* ---------------------------------------------------------------------------- Prepend the following line to the [On Change Script] code. ---------------------------------------------------------------------------- */ getNodeFromXML(formXML, 'on_load_code').setAttribute('onload_event', '');
Evolv won't let us add javascript functions to a form's [After Load Code] field. The following is a WORKAROUND for this limitation.
+ The anonymous function uses a variable to trigger the [OnChange] event on the form.
+ The additional line of code removes the anonymous function from the form's XML in order to avoid an XSLT error.
+ The anonymous function's curly braces are doubled on purpose to avoid an XSLT error.

How to use:
- Create a variable named [on_load_code] of type {Boolean}
- Paste the following code on the [On Load Script] field of the [on_load_code] variable
- Add the code you want executed to the [On Change Script] field of the [on_load_code] variable

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.