Databases Reference
In-Depth Information
Listing 11-5. JavaScript Code for the Save Value on Cascade Plug-in
(function($){
$.widget("ui.pg password", {
options: {
warningMsgIcon: null,
warningMsgText: null,
warningMsgWidth: null,
warningMsgAlignment: null,
passwordAlignment: null,
offset: null
},
create: function() {
var uiw = this;
uiw.element
.keypress(function(jQevent) {
//Code based on Joe Liversedge's submission on http://stackoverflow.com
var character = String.fromCharCode(jQevent.which);
if (character.toUpperCase() === character.toLowerCase()) {
return;
}
// SHIFT doesn't usually give us a lowercase character. Check for this
// and for when we get a lowercase character when SHIFT is enabled.
if (
(jQevent.shiftKey && character.toLowerCase() === character) ||
(!jQevent.shiftKey && character.toUpperCase() === character)
) {
uiw. showMessage();
} else {
uiw. hideMessage();
}
})
.blur(function() {
uiw. hideMessage();
});
},
showMessage: function() {
var uiw = this;
var html;
var warningId = uiw.element.attr('id') + ' CL WARNING';
if (!$('#' + warningId).length) {
html =
'<div class="ui-state-highlight ui-corner-all" style="width: ' +
uiw.options.warningMsgWidth +
'px; padding: 0pt 0.7em;" id="' + warningId + '"><table><tr><td>\n' +
' <span class="ui-icon ' + uiw.options.warningMsgIcon +
'" style="float: left; margin-right:0.3em;"></span></td><td>' +
Search WWH ::




Custom Search