I have a complex function that loops through the elements during the onSuccess: of my js and I'm getting the following error that I haven't seen before.
exception encountered : {"message": "Invalid argument.", "description": "Invalid argument.", "number": -2147024809, "name": "Error"}
The js function looks like this:
if(Object.isArray(list)){
list.each(function(listItem, index){
if(!Object.isUndefined(listItem.disabled)){
listItem.disabled = disableFlag;
}
});
}
that is called from the onSuccess: portion of an Update. My html is a button that is calling the noted function from an onclick. When I run it the onException: always happens and I'm getting the error by:
Object.toJSON(exception)
Has anyone seen this before? I have tried playing around with the functionality and it seems that when I use the button to do what it's supposed to do after a specific sequence of events is the only time this happens. So, I placed an arbitrary link on the page and wanted to see if I clicked that, what would happen and it updated the JSON object on the page and allowed for me to use the button for it's set action without the error. Any help would be appreciated.
Most of the time this kind of error happens in IE when you set an attribute of a DOM element.
If listItem is DOM element then maybe it's not yet added to the document or disableFlag is an invalid value. Or the error happens outside the provided code.
Related
I've looked at every other post I could find, and none of them resolved the issue for me.
I have a single call to the ReCaptcha API in my document head:
<script src="https://www.google.com/recaptcha/api.js?hl=he-IL&onload=onloadCallback&render=explicit" type="text/javascript"></script>
And then immediately after
var onloadCallback = function() {
grecaptcha.render("recaptcha2", {
sitekey: "6LendPIUAAAAAGQqB_2tq8fpgdGfBnEQA3v-CB0g",
theme: "light"
});
};
And I get the following error in my console:
recaptcha__iw.js:60 Uncaught (in promise) Error: reCAPTCHA placeholder element must be an element or id
at mv (recaptcha__iw.js:60)
at Object.render (mootools-core.js:88)
at onloadCallback (register:56)
This is my live page:
https://www.tofesyashir.co.il/register
I've tried changing the order. I've tried adding async defer to my script call, but nothing has helped.
Also, very strangely, if I manually call grecaptcha.render, the error is triggered again, even though I use it on IDs that 100% exist in the page. For some reason it won't render on any div at all.
What do you guys think?
Looking at the stackm trace of the exception you're getting revelas, that the .render() method that actually gets called is from mootools:
Uncaught (in promise) Error: reCAPTCHA placeholder element must be an element or id
at mv (recaptcha__iw.js:60)
at Object.render (mootools-core.js:88)
at onloadCallback (register:56)
Since the mootools you use is minified, I can't quite tell where exactly it goes wrong. However it looks to me as if some parameter re-binding is done in that method, and likely this causes something else to be assigned to the first apremeter when, in whatever way, in the end the reCaptcha method ends up getting called.
So I tried removing mootools from your webpage in a local copy - and it does indeed solve the issue, reCaptcha works fine with mootools gone.
There is also an open bug report for this: https://github.com/google/recaptcha/issues/376. A link provided there leads to a solution posted in a related buig: updating mootools manually seems to fix the issue.
I have been trying to figure out this particular problem in my developer tools, but I've had no luck thus far. I have an error on one of my js files that says
Uncaught TypeError: Cannot read property 'value' of null
The following error refers to the 1st variable of dt_version below. The particular thing is if I comment out the first line of code. I get the same error on the following variables of offload1 and offload2. The variable is a number that I am trying to get passed over. I run this function on my body when the page loads...onload=updatetotal();
function updatetotal() {
var dt_version = document.getElementById("dt_version").value-0;
var offload1 = document.getElementById("capacity_offload1").value-0;
var offload2 = document.getElementById("capacity_offload2").value-0;
var offload3 = document.getElementById("capacity_offload3").value-0;
}
If a run an if statement looking for document.getElementByID("dt_version");...it defaults to false..so its not being carried over though on the previous page, I can see its input fine with the value in it. What am I missing here guys?
This error means that the id dt_version does not exist. Check your html to make sure it is there:
var dt = document.getElementById("dt_version");
if (dt){
// do your stuff
}else {
console.log("dt does not exist")
}
Another cause for this error may be- as you are calling the javascript function on page load there is a possible chance that your control is not yet completely rendered to the page. A simple solution is just move that control to the beginning of the page. If it doesn't work then an reliable solution is, call the function inside jquery $(document).ready().
I'm using jqgrid with grails and need to select some objects. This works for one given object. My problem is that sometimes, calling function has no id. So there is nothing to do after grid completion. And I'm not able to do that even after trying if (false)... In all case, grid.jqgrid("setSelection... is executed and I get the message
java.lang.NullPointerException
Cannot get property 'id' on null object
which is true. But why is this line executed ???
gridComplete: function() {
if (false) {
grid.jqGrid("setSelection",'${cableFocus.id}',true);
}
return;
I have a second question : How can I use gridComplete to select several rows instead of one ?
Thanks very much for any help,
Olivier
The problem is not with gridComplete or your if statement (which is javascript). As you are getting a java error i'm guessing ${cableFocus.id} is placeholder (which will always get exectuted)
So the javascript is not running but your java code is still attempting to run and throwing the error
So I am getting the following error in firebug regarding jQuery UI. It would be as simple if it was a matter of a process-of-elimination on the JS on the page, but there is allot of JS as well as some on the page and some on the site.master.
ERROR
(this.uiDialogTitlebarCloseText = c("<span/>"))
.addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo
is not a function
Is there a way in Firebug to see what javascript is the initial caller?
Well your problem is likely that m.closeText is null. If you pass a null argument to text() it will actually return the text of the element, and not set the text to null.
I'm not sure about how to debug it though.
EDIT: The error is thrown because if text(null) returns a string, than you'll be saying string.appentTo rather than $().appendTo.
I'm using jQuery 1.3.2 and it's breaking under Safari 4 for mysterious reasons.
All of my javascript references are made right before the tag, yet with the following code:
var status = $('#status');
status.change( function(){ /* ... */ } );
The following error is displayed in the Web Inspector:
TypeError: Result of expression 'status.change' [undefined] is not a function.
However the error is not encountered if I eliminate the variable assignment attach the change method directly like so:
$('#status').change( function(){ /* ... */ } );
Why? I need to use variables for this and several other findById references because they're used many times in the script and crawling the DOM for each element every time is regarded as bad practice. It shouldn't be failing to find the element, as the javascript is loaded after everything except and .
Try changing the variable to something other than "status."
It's confusing your variable with window.status (the status bar text). When I typed var status = $('#status') into the debugging console, the statusbar changed to [Object object]. Must be a bug in Safari.
If you put the code inside a function, so that status becomes a function-local variable, it should work.
It's standard practice in jQuery to wrap things in a
$.onready(function() {
});
This makes sure the DOM is loaded before you try to manipulate it.