Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4640 from uGoMobi/textinput

Fixes #4636 and #4637 - Class ui-disabled was not added during enhancement of disabled textinputs
  • Loading branch information...
commit 1224c0ef9c51541b1c8ed7afc57359eea4b0ac17 2 parents 7cf44d4 + aa63dc4
@jaspermdegroot jaspermdegroot authored
View
21 docs/forms/search/options.html
@@ -38,6 +38,20 @@
<p>The text input plugin has the following options:</p>
<dl>
+ <dt><code>clearSearchButtonText</code> <em>string</em></dt>
+ <dd>
+ <p class="default">default: "clear text"</p>
+ <p>Sets the text used for the button that clears the search input of text.</p>
+ <pre><code>$('.selector').textinput(<strong>{ clearSearchButtonText: "custom value" }</strong>);</code></pre>
+ </dd>
+
+ <dt><code>disabled</code> <em>boolean</em></dt>
+ <dd>
+ <p class="default">default: false</p>
+ <p>Sets the default state of the search input to disabled when "true".</p>
+ <pre><code>$('.selector').textinput(<strong>{ disabled: "true" }</strong>);</code></pre>
+ </dd>
+
<dt><code>initSelector</code> <em>CSS selector string</em></dt>
<dd>
<p class="default">default: "input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea, input:not([type])"</p>
@@ -59,13 +73,6 @@
<pre><code>$('.selector').textinput(<strong>{ theme: "a" }</strong>);</code></pre>
</dd>
- <dt><code>clearSearchButtonText</code> <em>string</em></dt>
- <dd>
- <p class="default">default: "clear text"</p>
- <p>Sets the text used for the button that clears the search input of text.</p>
- <pre><code>$('.selector').textinput(<strong>{ clearSearchButtonText: "custom value" }</strong>);</code></pre>
- </dd>
-
</dl>
</form>
View
7 docs/forms/textinputs/options.html
@@ -38,6 +38,13 @@
<p>The text input plugin has the following options:</p>
<dl>
+ <dt><code>disabled</code> <em>boolean</em></dt>
+ <dd>
+ <p class="default">default: false</p>
+ <p>Sets the default state of the text input to disabled when "true".</p>
+ <pre><code>$('.selector').textinput(<strong>{ disabled: "true" }</strong>);</code></pre>
+ </dd>
+
<dt><code>initSelector</code> <em>CSS selector string</em></dt>
<dd>
<p class="default">default: "input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea, input:not([type])"</p>
View
26 js/widgets/forms/textinput.js
@@ -15,7 +15,8 @@ $.widget( "mobile.textinput", $.mobile.widget, {
// This option defaults to true on iOS devices.
preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1,
initSelector: "input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea, input[type='time'], input[type='date'], input[type='month'], input[type='week'], input[type='datetime'], input[type='datetime-local'], input[type='color'], input:not([type])",
- clearSearchButtonText: "clear text"
+ clearSearchButtonText: "clear text",
+ disabled: false
},
_create: function() {
@@ -131,16 +132,31 @@ $.widget( "mobile.textinput", $.mobile.widget, {
$( window ).load( keyup );
}
}
+ if ( input.attr( "disabled" ) ) {
+ this.disable();
+ }
},
disable: function(){
- ( this.element.attr( "disabled", true ).is( "[type='search'],:jqmData(type='search')" ) ?
- this.element.parent() : this.element ).addClass( "ui-disabled" );
+
+ if ( this.element.attr( "disabled", true ).is( "[type='search'],:jqmData(type='search')" ) ) {
+ this.element.parent().addClass( "ui-disabled" );
+ } else {
+ this.element.addClass( "ui-disabled" );
+ }
+ return this._setOption( "disabled", true );
+
},
enable: function(){
- ( this.element.attr( "disabled", false).is( "[type='search'],:jqmData(type='search')" ) ?
- this.element.parent() : this.element ).removeClass( "ui-disabled" );
+
+ if ( this.element.attr( "disabled", false ).is( "[type='search'],:jqmData(type='search')" ) ) {
+ this.element.parent().removeClass( "ui-disabled" );
+ } else {
+ this.element.removeClass( "ui-disabled" );
+ }
+ return this._setOption( "disabled", false );
+
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.