- 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-08-2015 01:53 AM
var svc= g_form.getValue("u_risk_type");
alert(svc);
if (svc == "Corporate") {
g_form.setValue("u_internal_ref", "CO000");
}
Put an alert and check the value of risk type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 02:13 AM
Hi Kalaiarasan,
The Values are the same as stated, I have an image below.
The script above still does not work. I received the below error:
What i need for it to do is if "Corporate" is selected from the drop down menu in Risk Type then the field "Internal Ref" auto populates with the text CO000.
Thanks
Riaz

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 02:19 AM
add a brace } at the end of the script and check
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 02:28 AM
Hi,
I did that and the error does go away. However, the Internal Ref field still is not populating with "CO000"
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var svc= g_form.getValue("u_risk_type");
alert(svc);
if (svc == "Corporate") {
g_form.setValue("u_internal_ref", "CO000");
}
}
Just can't work out why the above would not work.
Thanks
Riaz

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 02:30 AM
is the field name u_internal_ref correct?