PDA

View Full Version : [CLOSED] PasswordMask override issue



cwolcott
Apr 03, 2015, 12:45 AM
I have a js file that defines all of the Ext.Net overrides (bugs and enhancements) and I include it within my MasterPage.aspx. Everything works fine until I call a page that does not use the plugin PasswordMask. The following javascript error occurs

Uncaught TypeError: Cannot read property 'override' of undefined

Do I need to pull this override out and only call it when needed?

Below is an example with the latest override from Thread 58011 (http://forums.ext.net/showthread.php?58011-OPEN-775-PasswordMask-HideAll-issue), but I commented out the Plugin.



<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html>
<script runat="server">

</script>
<head runat="server">
<title></title>
<style type="text/css">
</style>
<script type="text/javascript">
Ext.net.PasswordMask.override({
renderHiddenField: function () {
var field = this.getCmp();

if (field.ownerCt) {
field.ownerCt.items.add(this.hiddenField);
} else {
this.hiddenField.render(field.el.parent());
}

field.inputEl.on("keydown", this.onKeyDown, this);
},

onKeyDown: function (e) {
var me = this,
oldValue = me.cmp.lastValue || "";

if (me.mode != "hideall") {
return;
}

setTimeout(function () {
var newValue = me.cmp.getValue(),
key = e.getKey();

if ((newValue.length < oldValue.length) && ((key === e.BACKSPACE) || (key === e.DELETE))) {
me.onDelete(me.getCaretRange(), oldValue.length - newValue.length);
} else {
me.maskChars(newValue);
}

me._maskAll();
}, 0);
}
});
</script>
</head>
<body>
<ext:ResourceManager runat="server" />

<ext:Panel runat="server" Title="Password Mask Issue" Margin="5" Height="200" Width="400" BodyPadding="10" UI="Danger">
<Items>
<ext:TextField ID="Password" runat="server" FieldLabel="Password" ClientIDMode="Static" SelectOnFocus="true">
<%--<Plugins>
<ext:PasswordMask runat="server" Mode="HideAll" Pattern="z" AllowAnyChars="true" />
</Plugins>--%>
</ext:TextField>
</Items>
<Buttons>
<ext:Button runat="server" Text="Login" Handler="Ext.Msg.alert('Password ...', App.Password.getPassword());" />
</Buttons>
</ext:Panel>
</body>
</html>

Daniil
Apr 03, 2015, 8:28 AM
Hi Chris,

PasswordMask is an UX. It means that it is not included into the combined JavaScript file (extnet-all.js). It is in an individual source file and it is only automatically loaded if a PasswordMask is detected on the page.


Do I need to pull this override out and only call it when needed?

Yes.

Or always preload the PasswordMask resources in, say, Page_Load.

ResourceManager.RegisterControlResources<PasswordMask>();

cwolcott
Apr 04, 2015, 1:22 AM
I have currently decided to break it out into its own js. Looking at other overrides you have suggested overtime I thought I would have problems with the following:


Ext.net.Callout.override (Because it follows the same pattern as Ext.net.PasswordMask.override)
Ext.ux.RowExpander.override (Because you mentioned UX is the previous post)


But I have not experienced any javascript errors.

Daniil
Apr 04, 2015, 8:10 AM
Ext.net.Callout.override (Because it follows the same pattern as Ext.net.PasswordMask.override)



Sorry, I don't understand. Please clarify.

The Callout's JavaScript sources is in the main file - extnet-all.js.


Ext.ux.RowExpander.override (Because you mentioned UX is the previous post)

It is an exclusion. The RowExpander JavaScript sources is in the main file as well. As far as I can remember we renamed it to Ext.net.RowExpander in Ext.NET v3.

cwolcott
Apr 06, 2015, 12:38 AM
Sorry I didn't mean to confuse anyone. Everything is working fine. You can close this thread.