I want to trigger an event when the input of a select2 search returns no results.
I want to trigger an event with the input value as a parameter for database search. Does anyone know how I can do this?
How can not capture the keypress event of the <input> within the select2 box?
Related
I have an input box (FieldTest) on HTML page, and a javascript function that invoked when the value of the input box is changed.
When changing the value of the input box manually, then the function is triggered, but when I change that by jquery $("#FieldTest").val('Some Text'); Then the onchange function is not triggered!
Any Idea??
The onchange event is dispatched only if the user is typing in the input and the input loses focus.
To dispatch it manually, simply use this line:
$(“#FieldTest”).change();
Changing the value programmatically will not trigger an onChange event. You will have to create and dispatch one manually.
A little Explanation : I am using List view control of kendo UI(Telerik). I am triggering an update event of that control after editing the fields in list view. The list view control is having some text-boxes, a dropdown,checkbox and a submit button. When a user change something, ideally it should trigger update but its not doing update because control is not able to judge if there is a change in model.
It is only working if I input something in textbox and just click on outside of textbox i.e just do a onblur before hitting submit. I don't know why it is happening but what I need is to just trigger a focus event but in a hidden mode so that user is unaware of it but it just happens after a user input something in textbox so that the list view control works successfully.
I am trying to do it like below but it will get noticed to user. How can i trigger focus in hidden mode after a user just enter something in textbox before hitting a submit?
function BlurFunc() {
debugger;
$(this).closest('li').find('.inputField').focus();
}
Without your code it is not clear whether you are using MVVM data binding to your model, but this may help; from http://docs.telerik.com/kendo-ui/framework/mvvm/bindings/value:
By default the value binding relies on the change DOM event, which is
raised after blurring the element whose value has changed. This means
that the value from the View-Model is updated when the element loses
focus. The data-value-update attribute can be used to specify a
different DOM event, such as keyup or keypress. The keydown event is
not supported, because the DOM element value is not yet updated when
that event triggers.
For example, try adding data-value-update="keyup" as an attribute to your text box input element:
<input data-value-update="keyup" data-bind="value: inputValue" />
This should then update the model value upon each key press and not wait until focus has been removed.
I am testing an app where we have written a directive which will attach blur event to input element,
Once user type some value and come out from textbox then it will check if value is not duplicate,
based on response it will set value using ctrl.$setValidity('unique', true);
When I am setting some unique to textbox using elem.sendKeys('newVal') and go to another input, it does not trigger blur event attached to the element.
How can I stop triggering the onChange event of a textbox in below mentioned scenario?
I have two text boxes on an aspx page;
If user change first text box value and its onChange event there is an asynchronous service call which updating the second textbox. During service call the control shifted on the second textbox. As the second text box value has been changed before it got focus, It triggers the second TextBox onChange event.
Hi I am using a dojo select, I have a text box where a certain ID is entered and then based on what is chosen on the select box an action is performed. Now the problem is, suppose over two different requests the action remains the same and the id changes I cant trigger the function with the onChange event. How do i handle this? Even if the user opens the select box and chooses the same item as last time I want the function i've written to be called.
onchange fires when any option is changed of the combo box.In your case you are not changing the options so obviously that event will not fired.
You can try onclick instead.
Write the same code in onclick for the select element (however with some intelligent logic since onclick will keep on firing even before you are able to select any option which may not expected in your case..!).