Multiple fields with onChange
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2011 03:30 PM
I am using client scripts to set the incident state on my forms. This is working great however I do have one question.
One of my conditions is based off of if several fields change. I cannot use the modified function because there are some fields I do not want this to apply to. Is there a way you could apply onChange to multiple fields without making a separate client script?
If am example helps this is a single client script of mine...
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
//If the page isn't loading
if (!isLoading) {
//If the new value isn't blank
if(newValue != '') {
//Type appropriate comment here, and begin script below
var state;
state = g_form.getValue('incident_state');
//alert("state = " + state);
if(state == '210' || state == '220'){
g_form.setValue('incident_state', '230');
}
}
}
}
Thanks,
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2016 06:12 PM
Josh,
From the time I designed it, calculateDuration could be a few things. The calculateDuration function as I may have written it, may have been included in a UI Script which is then placed on the form (like a field would be) using Macro (UI Macro) and Formatters.
If you look under UI Scripts and search the sys_ui_script.script field for the string "calculateDuration", you may be able to find it buried within a script that includes a set of functions that pertains to a specific form (e.g. Requested Item form, Task Scheduler form, etc.).
This was my way of including a bunch of client-side functions that I could call at will within the form, written all in one inclusive place.
If you can't find it in there, let me know. I will need to look at a developer's instance to see where else it may be.
calculateDuration function does, in fact, call the Script Inlcude (server call) to get the value back so it is written client-side somewhere, if not where I just stated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 09:40 AM
Found it. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2017 12:06 PM
I know this post is pretty outdated, but it is also the first to show up on google and I feel that the solution I found below solved this issue very easily for me:
http://www.snc-blog.com/2012/06/04/client-script-for-multiple-fields/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2017 02:58 PM
This worked for me perfectly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2021 12:38 PM
This failed in Quebec, any experience with that?