- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 05:39 PM
i have successfully coded OnChange client scripts to show and hide various fields on the form, but now I need to have those fields shown/hidden when the form opens and the record already has data.
I coded a OnLoad script, but it doesn't seem to even fire (I put an addErrorMessage('HI'); just to see if it starts. The message does not appear. How do I code the Client Script so that it fires when the form is opened and before any data is changed.
Here is part of the script I have written
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 06:23 PM
Hi John,
Change line 2 from:
To:
var RouterType = g_form.getValue('router_type');
Make sure the names are the correct (technical) names of the field as well.
In addition, change linke 8:
To:
RouterType == ''
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 05:56 PM
I took the two getValue method call out and the message appeared. When I put them back in, the CS does not run. So the issue is "how do I access data in an OnLoad CS?" One thread said to use getDisplayBox, but it returns "undefined" as the value and the record I am looking at has data. This should be fairly standard functionality for SN. If I open up a form created by a Record Producer, I want to hide and show fields based on the values that the requestor specified in the Catalog.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 06:19 PM
Hi John,
use: g_form.getValue() instead
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 06:23 PM