- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 07:22 AM
I have defined a funtion in the client controller, but when the field updates, the console logs an error stating that the function cannot be found:
Uncaught ReferenceError: getFields is not defined
at HTMLInputElement.onchange (sp?id=sc_cat_item_guide&sys_id=8c9ef09…:1)
at Object.trigger (js_includes_sp.jsx?v=10-25-2016_1048&lp=Thu_Feb_16_06_54_24_PST_2017&c=5_132:2850)
at HTMLInputElement.<anonymous> (js_includes_sp.jsx?v=10-25-2016_1048&lp=Thu_Feb_16_06_54_24_PST_2017&c=5_132:3243)
at Function.each (js_includes_sp.jsx?v=10-25-2016_1048&lp=Thu_Feb_16_06_54_24_PST_2017&c=5_132:215)
at jQuery.fn.init.each (js_includes_sp.jsx?v=10-25-2016_1048&lp=Thu_Feb_16_06_54_24_PST_2017&c=5_132:59)
at jQuery.fn.init.trigger (js_includes_sp.jsx?v=10-25-2016_1048&lp=Thu_Feb_16_06_54_24_PST_2017&c=5_132:3242)
at constructor.triggerChange (js_includes_sp.jsx?v=10-25-2016_1048&lp=Thu_Feb_16_06_54_24_PST_2017&c=5_132:51550)
at constructor.onSelect (js_includes_sp.jsx?v=10-25-2016_1048&lp=Thu_Feb_16_06_54_24_PST_2017&c=5_132:52463)
at constructor.selectHighlighted (js_includes_sp.jsx?v=10-25-2016_1048&lp=Thu_Feb_16_06_54_24_PST_2017&c=5_132:52032)
at constructor.<anonymous> (js_includes_sp.jsx?v=10-25-2016_1048&lp=Thu_Feb_16_06_54_24_PST_2017&c=5_132:51286)
HTML:
<sn-record-picker onChange="getFields(columnObj)" field="columnObj.value" table="columnObj.table"
display-field="columnObj.displayField" display-fields="'u_nummer'" value-field="columnObj.valueField"
search-fields="columnObj.searchFields" default-query="columnObj.query" page-size="100" >
</sn-record-picker>
Client script:
$scope.getFields = function (cObj) {
console.log(cObj);
}
Can anyone provide me with at working example on using OnChange?
Thanks.
/Thomas
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 03:42 PM
Found the error:
The correct attribute name is on-change - not onChange. Duh!
Using that, it works.
Sorry for disturbing.
Regards,
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 07:33 AM
Hi Thomas,
Could you explain what is the exact requirement you are trying to achieve?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 09:54 AM
Hi,
Thanks for asking.
In this specific example, I would like to store the additional field values from the display-fields parameter in addition to the value specified by the field parameter.
columnObj is an iterator over the individual columns in a table row.
Generally speaking I was wondering if there is a way to get more than one value back, i.e. the whole record.
Regards
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 03:42 PM
Found the error:
The correct attribute name is on-change - not onChange. Duh!
Using that, it works.
Sorry for disturbing.
Regards,
Thomas