Jim Coyne
Kilo Patron
Options
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
07-18-2024
03:15 PM
Part of the "Tips 'N Tricks" series.
If you are writing an "onChange" Client or Catalog Client Script and need to look at the value of the field/variable the script is reacting to, you do NOT need to use "g_form.getValue('field_or_variable_name')". There's a variable called "newValue" in the function declaration that you should use instead:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
}
It contains the newly inputed/selected value of the field/variable so you do not need to go and get it again. Don't
waste any time writing code to go get it, it's there for you to use. Use it. Please.
It saves time (both writing it and when it executes) and the code is easier to read and understand.
- 544 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.