- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 09:24 AM
I have a 3 fields on a table's form needing to run a snippet of code when the field's value changes. The snippet obtains the necessary information from the form, and executes a GlideAjax call.
Is there any way to define this snippet of code as a client-side function for the table so the code does not have to be replicated and maintained within 3 separate onChange client scripts?
Currently:
Field 1 onChange - obtains form data and makes ajax call
Field 2 onChange - obtains form data and makes ajax call
Field 3 onChange - obtains form data and makes ajax call
Desire:
Field 1 onChange - call client-side function
Field 2 onChange - call client-side function
Field 3 onChange - call client-side function
client-side function - obtains form data and makes ajax call
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 09:31 AM
Hi,
There is one option to include your reusable client script along with an onLoad client script. These scripts are accesible within onChange client scripts.
You can try this out once
function onLoad(){
}
function myReusableScript(){
alert("I am in");
}
function onChange(){
myReusableScript();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 09:31 AM
Hi,
There is one option to include your reusable client script along with an onLoad client script. These scripts are accesible within onChange client scripts.
You can try this out once
function onLoad(){
}
function myReusableScript(){
alert("I am in");
}
function onChange(){
myReusableScript();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 09:34 AM
Or else you could use UI Scripts which act as reusable client side scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 09:48 AM
Thank you. This worked exactly as I had hoped.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 01:04 AM
thanks