Condition/OnClick field on a client script for a record producer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2010 10:53 AM
I am trying to run a client script ONLY if a field on my form (caller_id) is not empty. Otherwise, I do not want it to run. I would assume I could put caller_id!='' in the condition/OnClick field to accomplish this, but it doesn't work. Why doesn't this work?
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2010 12:40 PM
function onLoad() {
if (g_form.getValue('current.caller_id'!= '')){
g_form.setValue('u_caller_user_id', g_form.getReference('caller_id').user_name);
}
OK - I'm still having issues. This is my code. Seems simple enough, but I can't get it to act right. I don't want it to run if my caller_id field is empty, but it doesn't run at all. We have another client script (that is already in place) that will not run if I set this one to global. I'm sorry to be a pain on this one, but it's so simple yet driving me crazy....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2010 01:08 PM
Take 'current' out of your script. That's only for server-side scripts.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2010 01:42 PM
Same result. I think I added "current" as one more thing to try earlier. Either way - same result...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2010 01:49 PM
Your code looks fine other than that. It's just down to standard troubleshooting now. Set up a script with nothing but an alert to see if you can get that to run. If that works, then add your if condition with an alert in it and get that to run. Narrow it down to the specific line or specific variable to see what's going on.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2010 02:45 PM
Does it make a difference that the field I'm trying to check is a reference field? I can't find anything anywhere that says so, but it just doesn't want to go into the 'if' statement....