All the triggers for javascript appear to be related to user interactions, blur, click, etc. Is there any way to trigger on a database lookup? For example, after a database lookup updates a hidden field?
Discussion
Discussion
You can manually tell the system there was a change using JavaScript.
The syntax is: $('.myClass select').trigger('change');
select is used for a drop-down field. If you are using a single line field, use input instead.
If the look-up you are referring to is performed by Javascript, just insert this line at the end of that function. If the look-up is performed by Forms, set this to run after a the input for the look-up is changed, then add a small delay.
Good luck!
Perhaps you can use on change to monitor the hidden field? So when its not empty then perform the java function?
|
The event occurs when the content of a form element, the selection, or the checked state have changed (for <input>, <keygen>, <select>, and <textarea>) |
That onchange action doesn't appear to be supported in forms. Sure would be nice though. Javascript doesn't debug well so I never know what is going on, just seems to either work or not work.
Here is how I tried to implement it, even a manual change is not considered a change with this code.
$(document).ready(function () { $('.sqlcomplete').onchange=function(){ document.getElementById("links").innerHTML = $('.sqlcomplete input').val(); } });
This code works just fine when someone blurs the field, but not when the look up activity accesses the field.
$(document).ready(function () { $('.sqlcomplete').on('blur', 'input', creatlinks); function creatlinks() { document.getElementById("links").innerHTML = $('.sqlcomplete input').val(); } });
I just found that on.('change', 'input', createlinks) is another option but still waits for a user to change the field, not a system change.