Infragistics ig.WebCapture Error - javascript

$('#btnTest').click(function () {
var captcha = $IG.WebCaptcha.find('capWebCaptcha');
alert(captcha.get_validationFailed());
// alert($IG.WebCaptcha);
});
This is throwing the following error:
Uncaught TypeError: $IG.WebCaptcha.find is not a function
I found the example from the URL below:
http://www.infragistics.com/help/aspnet/webcaptcha_captcha_validation.html
I am following all the instructions as provided. Has anybody seen this before or can somebody offer a work-around?

You can try to get reference using var captcha = ig_controls.capWebCaptcha, where the Id may differ if teh control is placed in panel, loaded from user control, etc.

Related

What is the equivalent command to close for chrome.runtime.openOptionsPage?

In a Chrome extension what is the equivalent of close to chrome.runtime.openOptionsPage? I have tried:
window.close();
and
chrome.runtime.closeOptionsPage();
This would need to be invoked from within the options page itself.
Update
According to wOxxOm in the comments below, "window.close()" should work. So this may be a bug in my browser Edge.
wOxxOm suggested using "chrome.tabs.remove". However I get an error using it this way from within the options script:
chrome.tabs.getCurrent(function(tab) {
chrome.tabs.remove(tab.id, function() { });
});
Error handling response: TypeError: Cannot read property 'id' of undefined

Nightwatch-friendly command or javascript function to reload a page

I have been trying the various suggestions for reloading a page.
Reload a page manually
With Nightwatch magellan testarmada. The error I see is "TypeError: Cannot read property 'apply' of undefined"
Has anyone else run into this problem/ solved it?
EDIT: client.navigate().refresh(); does not work.
Embarrassingly obvious, once I fixed it. I was calling it in an external function but the problem amounted to this:
module.exports = new Test({
'#disabled': false,
"test page that needs a reload" : function(client){
client
// set url
.url(this.url)
.pause(this.timeout)
.navigate().refresh() // does not work
.refresh() // does work.
},
});
Refrain yourself from using navigate here. Use the mentioned code below:
return client.refresh();

Get selected message data in Thunderbird extension

I need to get some e-mail message data in my Thunderbird extension. I found this example on MDN (https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIMsgMessageService):
var content = "";
var MessageURI = GetFirstSelectedMessage();
var MsgService = messenger.messageServiceFromURI(MessageURI);
var MsgStream = Components.classes["#mozilla.org/network/sync-stream-listener;1"].createInstance();
var consumer = MsgStream.QueryInterface(Components.interfaces.nsIInputStream);
var ScriptInput = Components.classes["#mozilla.org/scriptableinputstream;1"].createInstance();
var ScriptInputStream = ScriptInput.QueryInterface(Components.interfaces.nsIScriptableInputStream);
ScriptInputStream.init(consumer);
try {
MsgService.streamMessage(MessageURI, MsgStream, msgWindow, null, false, null);
} catch (ex) {
alert("error: "+ex)
}
ScriptInputStream .available();
while (ScriptInputStream .available()) {
content = content + ScriptInputStream .read(512);
}
alert(content);
However, when I run it I get the following error:
Timestamp: 2013.06.21. 14:47:21
Error: ReferenceError: GetFirstSelectedMessage is not defined
Source File: chrome://edus_extension/content/messengerOverlay.js
Line: 90
What is this 'GetFirstSelectedMessage' function and how can I get message URI without using it?
This documentation looks fairly outdated. I would suggest:
using gFolderDisplay.selectedMessage (try typing top.opener.gFolderDisplay.selectedMessage in the Error Console),
reading some recent code that uses Services and MailServices so as to simplify your code.
That being said, I don't know what you're trying to achieve but:
you'd certainly be better off using a wrapper such as MsgHdrToMimeMessage (self-reference: http://blog.xulforum.org/index.php?post/2011/01/03/An-overview-of-Thunderbird-Conversations)
if you absolutely, absolutely need to get the raw contents of the message, http://mxr.mozilla.org/comm-central/source/mailnews/db/gloda/modules/mimemsg.js#223 has an example on how to do that (it's the implementation of the said MsgHdrToMimeMessage; by simplifying it, you should be able to get directly the raw data of the message).
Good luck with that, once you get a working sample, please add it to the MDN wiki!
Cheers,
jonathan

How to get the error code of WMP plugin in IE when it fails to play some resource?

Recently I'm trying to make a web page for WMP troubeshooting.And what I want to do is, if the vistors cannot play the resource on my page because of some problems such as missing WMP codec,failing to pass DRM...etc, then I'll show them some information about how to fix it.I've googled an example and the problem is the property ErrorCode of the WMP object wmpocx always comes up as undefined while it do exist there.So how can I get the WMP error code in JSCript?
Regards
Find the solution by reading the source code of the Security component upgrade page on Microsoft's website.
Main code:
var error = wmpocx.error;
var errorItem;
var index; //index into the error queue.
var message;
//The error is an error object that can have multiple errors in a queue
//error.errorCount is the count of errors in the error queue
for(index=0; index<error.errorCount; index++)
{
errorItem = wmpocx.error.item(index);
//you can get information on the error with the following properties
//errorItem.errorCode
ecode = errorItem.errorCode;
message = errorItem.errorDescription;
}

Problem using window.location in a function called from onsubmit

I'm currently creating a very small form on my homepage using HTML and JavaScript. I've run into a problem I'm pretty sure I could circumvent somehow (probably in a pretty ugly way though), but I got interested in why this error appears.
I have a form on my page which I specify in the following way:
<FORM name="form1" onsubmit="submitTheScript()">
The function "submitTheScript()" is placed in the header and reads:
setCookie("F_GivenSum", GivenSum);
window.location="LastScreen.html";
"setCookie()" is a function that basically just, well, creates a cookie :).
Now, the problem arises with the last line of code. I'm trying to send the user to another page, after the cookie has been set (I'm doing some controls that the input value is alright, but I've skipped that part here) but FireFox gives me the following error:
uncaught exception: [Exception... "Cannot modify properties of a WrappedNative" nsresult: "0x80570034 (NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)" location: "JS frame :: chrome://global/content/bindings/autocomplete.xml :: onxblpopuphiding :: line 827" data: no]
I guess I can't call this function the way I do, from within a onsubmit command, however, I don't see why.
Okay, I did a quick test and found out that you need to assign the onsubmit event handler via javascript like so:
document.getElementById("myform").onsubmit = doSubmit;
function doSubmit() {
document.cookie = "F_GivenSum=200";
window.setTimeout(function() {
window.location = ('test2.html');
}, 20);
return false;
}
This did not give any errors in FF.

Categories

Resources