- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2015 02:40 PM
Hi,
I am trying to Auto Populate a field when a selection is a made from a drop down using client script.
My script which does not work is below. Any help would be appreciated.
So When "Risk Type" Corporate is selected the "Internal ref" should Auto Populate to CO000
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var svc = g_form.getReference('Corporate');
g_form.setValue('SR000', internal_ref);
}
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 03:20 AM
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var svc= g_form.getValue("u_risk_type");
alert('Outside'+svc);
if (svc == "Corporate") {
alert('Inside');
g_form.setValue("u_internal_ref", "CO000");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2015 02:50 PM
try:
var svc= g_form.getValue("u_risk_type"); //this should be the Risky Type column name and not the column label
if (svc = "Corporate") { //this should be the Corporate field value and not the label
g_form.setValue("u_internal_ref", "CO000"); //again, verify the field value for Internal Ref and the field value for CO000
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 01:09 AM
Hi Jordan,
Thanks for your reply. The Value "CO000" does not exist anywhere it is just what should be placed in that field. (so if it pre-populates CO000 someone can fill out the remaining in the field).
Below is the current script and the error received.
Many thanks for your help (as you can tell I am not really a scripter)
Thanks
Riaz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 01:30 AM
Hi Riaz,
There are some syntax error in your script.
Use this script :
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var svc= g_form.getValue("u_risk_type");
if (svc == "Corporate") {
g_form.setValue("u_internal_ref", "CO000");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 01:46 AM
Hi Nishi,
Thanks - The Syntax error did go away but when the drop down "Corporate" is selected the "Internal Ref" is not pre-populating to "CO000".
Please note: CO000 is just some text.
Any ideas?
Thanks
Riaz