jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
709 lines (705 loc) • 38.5 kB
HTML
<html lang="en">
<head>
<link rel="stylesheet" href="../../../../Styles/jqx.apireference.css" type="text/css" />
<script type="text/javascript" src="../../../../scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../../../scripts/documentation.js"></script>
<meta name="keywords" content="jQuery, password, password widget, password input" />
<meta name="description" content="This page represents the help documentation of the jqxPasswordInput widget." />
<title>jqxNavigationBar API Reference</title>
<script type="text/javascript">
$(document).ready(function () {
$(".documentation-option-type-click").click(function (event) {
$(event.target).parents('tr').next().find(".property-content").toggle();
});
});
</script>
</head>
<body>
<div id="properties">
<h2 class="documentation-top-header">Properties</h2>
<table class="documentation-table">
<tr>
<th>Name
</th>
<th>Type
</th>
<th>Default
</th>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span3'>disabled</span>
</td>
<td>
<span>Boolean</span>
</td>
<td>false
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Gets or sets whether the widget is disabled.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>disabled</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ disabled: true }); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/B5JxB/">disabled is set to true</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span9'>height</span>
</td>
<td>
<span>Number/String</span>
</td>
<td>"auto"
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Gets or sets the widget's height. The value may be "auto", a number or a string
like "Npx", where N is a number.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>height</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ height: 25 }); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/TCTpG/">height is set to '25px'</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span2'>localization</span>
</td>
<td>
<span>Object</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets the various text values used in the widget. Useful for localization.
</p>
<p>
Default value:
</p>
<pre><code>{ passwordStrengthString: "Password strength", tooShort: "Too short", weak: "Weak", fair: "Fair", good: "Good", strong: "Strong" }</code></pre>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>localization</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ localization: { passwordStrengthString: "חוזק סיסמא", tooShort: "קצר מדי", weak: "חלש", fair: "הוגן", good: "טוב", strong: "חזק"} });
</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/yY5cN/">localization is set to a custom object</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span6'>maxLength</span>
</td>
<td>
<span>Number</span>
</td>
<td>null
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Gets or sets the maximal number of characters in the password.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>maxLength</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ maxLength: "none" }); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/2myDQ/">maxLength is set to 7</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='property-name-disabled'>placeHolder</span>
</td>
<td>
<span>String</span>
</td>
<td>null
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Gets or sets the password input's placeholder text.
</p>
<h4>Code example</h4>
<p>
Initialize the widget with the <code>placeHolder</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ placeHolder: "Enter password:" });</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/487KW/">placeHolder is set to 'Enter a Password'</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span7'>passwordStrength</span>
</td>
<td>
<span>Function</span>
</td>
<td>null
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
(Requires jqxtooltip.js.)
</p>
<p>
A callback function for defining a custom strength rule. The function has three
parameters:
</p>
<ul>
<li>First parameter - the value of the password.</li>
<li>Second parameter - an object containing the numbers of different types of characters
- letters, numbers and special keys.
</li>
<li>Third parameter - the default strength value, based on the built-in rule.</li>
</ul>
<p>
<em>Note</em>: The property <code>showStrength</code> should be set to <code>true</code>
for <code>passwordStrength</code> to have an effect.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>passwordStrength</code> property specified.
</p>
<pre><code>$("#jqxPasswordInput").jqxPasswordInput({ showStrength: true, passwordStrength: function (password, characters, defaultStrength) {
var length = password.length;
var letters = characters.letters;
var numbers = characters.numbers;
var specialKeys = characters.specialKeys;
var strengthCoefficient = letters + numbers + 2 * specialKeys + letters * numbers * specialKeys;
var strengthValue;
if (length < 4) {
strengthValue = "Too short";
} else if (strengthCoefficient < 10) {
strengthValue = "Weak";
} else if (strengthCoefficient < 20) {
strengthValue = "Fair";
} else if (strengthCoefficient < 30) {
strengthValue = "Good";
} else {
strengthValue = "Strong";
};
return strengthValue;
}
});
</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/uD5Qz/">passwordStrength is set to a custom function</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span5'>rtl</span>
</td>
<td>
<span>Boolean</span>
</td>
<td>false
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Determines whether the right-to-left support is enabled.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>rtl</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ rtl: true }); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/axvSN/">rtl is set to true</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span8'>strengthColors</span>
</td>
<td>
<span>Object</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets the the colors used in the tooltip which shows the strength.
</p>
<p>
Default value:
</p>
<pre><code>{ tooShort: "rgb(170, 0, 51)", weak: "rgb(170, 0, 51)", fair: "rgb(255, 204, 51)", good: "rgb(45, 152, 243)", strong: "rgb(118, 194, 97)" }</code></pre>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>strengthColors</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ strengthColors: { tooShort: "Red", weak: "Red", fair: "Yellow", good: "Blue", strong: "Green" } }); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/YyUu4/">strengthColors is set to a custom object</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span1'>showStrength</span>
</td>
<td>
<span>Boolean</span>
</td>
<td>true
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
(Requires jqxtooltip.js.)
</p>
<p>
Gets or sets whether a tooltip which shows the password's strength will be shown.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>showStrength</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ showStrength: true }); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/m5EbW/">showStrength is set to false</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span4'>showStrengthPosition</span>
</td>
<td>
<span>String</span>
</td>
<td>"right"
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
(Requires jqxtooltip.js.)
</p>
<p>
Gets or sets the position of the tooltip which shows the password strength.<br />
Possible values:
</p>
<ul>
<li>"top"</li>
<li>"bottom"</li>
<li>"left"</li>
<li>"right"</li>
</ul>
<p>
<em>Note</em>: The property <code>showStrength</code> should be set to <code>true</code>
for <code>showStrengthPosition</code> to have an effect.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxNavigationBar with the <code>showStrengthPosition</code> property
specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ showStrengthPosition: "none" });
</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/2ByaM/">showStrengthPosition is set to 'left'</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span12'>strengthTypeRenderer</span>
</td>
<td>
<span>Function</span>
</td>
<td>null
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
(Requires jqxtooltip.js.)
</p>
<p>
A callback function for custom rendering of the tooltip which shows the password
strength. The function has three parameters:
</p>
<ul>
<li>First parameter - the value of the password.</li>
<li>Second parameter - an object containing the numbers of different types of characters
- letters, numbers and special keys.
</li>
<li>Third parameter - the default strength value, based on the built-in rule.</li>
</ul>
<p>
<em>Note</em>: The property <code>showStrength</code> should be set to <code>true</code>
for <code>strengthTypeRenderer</code> to have an effect.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>strengthTypeRenderer</code> property
specified.
</p>
<pre><code>$("#jqxPasswordInput").jqxPasswordInput({ showStrength: true, strengthTypeRenderer: function (password, characters, defaultStrength) {
var length = password.length;
var letters = characters.letters;
var numbers = characters.numbers;
var specialKeys = characters.specialKeys;
var strengthCoefficient = letters + numbers + 2 * specialKeys + letters * numbers / 2 + length;
var strengthValue;
var color;
if (length < 8) {
strengthValue = "Too short";
color = "rgb(170, 0, 51)";
} else if (strengthCoefficient < 20) {
strengthValue = "Weak";
color = "rgb(170, 0, 51)";
} else if (strengthCoefficient < 30) {
strengthValue = "Fair";
color = "rgb(255, 204, 51)";
} else if (strengthCoefficient < 40) {
strengthValue = "Good";
color = "rgb(45, 152, 243)";
} else {
strengthValue = "Strong";
color = "rgb(118, 194, 97)";
};
return "<div style='color: " + color + ";'>" + strengthValue + "</div>";
}
});
</code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/N3zHM/">strengthTypeRenderer is set to a custom function</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span10'>showPasswordIcon</span>
</td>
<td>
<span>Boolean</span>
</td>
<td>true
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Gets or sets whether the Show/Hide password icon will appear.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>showPasswordIcon</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ showPasswordIcon: false }); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/daTQ5/">showPasswordIcon is set to false</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span63'>theme</span>
</td>
<td>
<span>String</span>
</td>
<td>''
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Sets the widget's theme.
</p>
jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The
base stylesheet creates the styles related to the widget's layout like margin, padding,
border-width, position. The second css file applies the widget's colors and backgrounds.
The jqx.base.css should be included before the second CSS file. In order to set
a theme, you need to do the following:
<ul>
<li>Include the theme's CSS file after jqx.base.css.<br />
The following code example adds the 'energyblue' theme.
<pre><code><link rel="stylesheet" href="../../../../jqwidgets/styles/jqx.base.css"
type="text/css" /> <link rel="stylesheet" href="../../../../jqwidgets/styles/jqx.energyblue.css"
type="text/css" /> </code></pre>
</li>
<li>Set the widget's theme property to 'energyblue' when you initialize it.
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ theme: "energyblue" });</code></pre>
</li>
</ul>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/rbW32/">theme is set to 'energyblue'</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span11'>width</span>
</td>
<td>
<span>Number/String</span>
</td>
<td>"auto"
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Gets or sets the widget's width. The value may be "auto", a number or a string like
"Npx", where N is a number.
</p>
<h4>Code example</h4>
<p>
Initialize a jqxPasswordInput with the <code>width</code> property specified.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput({ width: "150px" }); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/Ek4Yb/">width is set to '250px'</a>
</div>
</div>
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<h2 class="documentation-top-header">Events</h2>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span27'>change</span>
</td>
<td>
<span>Event</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
This event is triggered when the value in the input is changed.
</p>
<h4>Code example</h4>
<p>
Bind to the change event by type: jqxPasswordInput.
</p>
<pre><code>$('#jqxPasswordInput').on('change', function (event) {
var type = event.args.type; // keyboard or null depending on how the value was changed.
}); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/7fs2J/">Bind to the change event by type: jqxPasswordInput.</a>
</div>
</div>
</td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<h2 class="documentation-top-header">Methods</h2>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span37'>render</span>
</td>
<td>
<span>Method</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Renders the widget.
</p>
<div class="methodArgs">
<table class="arguments">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><em>None</em></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<strong>Return Value</strong><br />
<em>None</em>
</div>
<h4>Code example</h4>
<p>
Invoke the <code>render</code> method.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput('render'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/rtLFU/">renders the jqxPasswordInput.</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span14'>refresh</span>
</td>
<td>
<span>Method</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Refreshes the widget.
</p>
<div class="methodArgs">
<table class="arguments">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><em>None</em></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<strong>Return Value</strong><br />
<em>None</em>
</div>
<h4>Code example</h4>
<p>
Invoke the <code>refresh</code> method.
</p>
<pre><code>$('#jqxPasswordInput').jqxPasswordInput('refresh'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/SvZJb/">refresh the jqxPasswordInput.</a>
</div>
</div>
</td>
</tr>
<tr>
<td class="documentation-option-type-click">
<span id='Span15'>val</span>
</td>
<td>
<span>Method</span>
</td>
<td></td>
</tr>
<tr>
<td colspan='3' style='width: 100%'>
<div class="documentation-option-description property-content" style="display: none;">
<p>
Gets or sets the password. If the parameter is set, sets the value of the password
in the input. If there is no parameter set, returns the string value of the password.
</p>
<div class="methodArgs">
<table class="arguments">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><em>value</em></td>
<td>String</td>
<td></td>
</tr>
</tbody>
</table>
<strong>Return Value</strong><br />
<em>String</em>
</div>
<h4>Code example</h4>
<p>
Invoke the <code>val</code> method.
</p>
<pre><code>// @param String. The new value of the password.<br />$('#jqxPasswordInput').jqxPasswordInput('val', "New password");</code></pre>
<p>
or
</p>
<pre><code>var password = $('#jqxPasswordInput').jqxPasswordInput('val'); </code></pre>
<div style="padding-bottom: 5px;">
<em>Try it:</em> <a target="_blank" href="http://jsfiddle.net/jqwidgets/Z59s5/">sets new value of the jqxPasswordInput.</a>
</div>
</div>
</td>
</tr>
</table>
<br />
</div>
</body>
</html>