Could you add a refresh method for text inputs, so that the new clear button (data-clear-btn="true") can be redetermined when the value changes outside of the input's own control?
See my example: http://jsfiddle.net/w83pZ/
Thanks for submitting the issue. All widgets should have a refresh method so I agree we have to add this for textinput.
a workaround for this is to trigger 'change'
submitted a pull request
True, but there was some reason I didn't want to use change - probably because I had another event handler on that, which would have caused an unnecessary ajax request or something. So in the absense of the refresh method, my current workaround is triggering keyup on the element instead.
@JorisDebonnet , ur right...
Slightly related: the clear button should be hidden again after form reset. See @weisborg his comment here #1834 (comment)
Which probably only means that the fields should be 'refreshed' after form reset -- since a clear button might actually remain if the textfield's default value is not empty.
In most cases that will be sufficient. However, in general the refresh method provides the possibility to set all options on the fly. For example: if someone uses a form validator and wants to programmatically change the theme to highlight an input, that should be possible with refresh
Will be also good to re-run autogrow code for textarea in refresh() method...
reference to issue #5708
and previous pull request.
added 'refresh' method to textinput.
added a _private method '_refresh' and called same from create and refresh.
demo test page :http://jsbin.com/edidil/7/ [Got various combinations of input fields and button to refresh input.]
demo test page : http://johnchacko.net/samples/textinputs.html
Closing as fixed on master.
To set an option like clearBtn you should use $( ".selector" ).textinput( "option", "clearBtn", true );. A refresh method has been added for enable/disabled state.
$( ".selector" ).textinput( "option", "clearBtn", true );