How To Add Custom Javascripts To Forms
The Quik! Forms Engine is highly extensible by making it possible for customers to write and add their own custom javascript functions to use on the form. For example, perhaps you want to calculate the total value of several fields, or perhaps lookup the city based on the zip code. These types of custom features can be added to the Quik! Form at run-time with your own custom javascripts. This section does not discuss how to write Javascript and only focuses on how to implement your custom script. When you write your own javascript be aware that Quik! is pre-integrated and already includes JQuery, a common javascript library. You may find it easier to make use of your script using JQuery.
Adding A Custom Function
The simplest approach is to build a custom javascript function that performs some action on the form. You can do this by writing your script and then adding it to the CustomJavaScript property in the Quik! Forms Engine. For example:
objQFE.CustomJavaScript = New List(Of String)
objQFE.CustomJavaScript.Add("$(document).ready(function(){$('input[name=""1own.M.City""]').keyup(function(){alert('key up!')})});")
In this example, when the user enters some text in the field named "1own.M.City" an alert will show up saying "key up!".
Adding A Javascript File
If you're adding lots of javascript functions it may be better to write a .JS file and include it as a referenced file. For example:
objQFE.CustomJavaFileIncludePath = New List(Of String)
objQFE.CustomJavaFileIncludePath.Add("https://www.mydomain.com/scripts/custom.js")
objQFE.CustomJavaScript.Add("$(document).ready(function(){$('input[name=""1own.M.City""]').keyup(customhello)});")
In this example, when the user fills in the field named "1own.M.City"Â the function "customhello" will fire, which is within the external script file (custom.js).
For help regarding Quik! Forms and the Quik! API
Email: support@quikforms.com | Phone: (877) 456-QUIK