In our app we have a js frunction to prevent the autocomplete of inputs and textboxes:
The function it's loaded when the app starts so that be executed in every form we have.
The problem that we have is that when we open a kendo window the function it's not working and the text boxes show possible options to select.
We would like know how to load this function and prevent these suggestions.
We could add a call in each window but it does not seem like the best option. We believe that it should be defined only once. Any idea how to fix it?
Thanks in advance.
11 Answers, 1 is accepted
Could you provide more details on you scenario and on how opening a Window is related to the inputs? Are the inputs placed within the Window by using the .Content() option? Is the Window's content loaded through AJAX? Have you tried calling the function in the Window's Open event handler?
I didn't know about the event handler, I'm going to investigate.
About the windows are loaded like this:
And the window declaration:
I've pasted a wrong window declaration. The correct window is:
I've been looking the window open event handler. The problem that I've using this is that I should edit all the windows in the app, and add it in every new window. I was looking for a way to only add it in one place and for all the windows.
Would be possible override the window open event handler?
Thanks in advance.
You can attach a single Open event handler to all the Windows on your page as demonstrated below:
It's not working, the function is called when the view is loaded and when the window is opened it's not called again. First I've tried with my function autocompleteoff (the function I want to execute):
and the autocomplete off it's not setted on textboxes. Then I've changed to this function:
and the alert it's thrown when the main page it's loaded, not when the window it's opened. I've also tried with activated event and it's not working too.
I'm declaring my window and I'm calling it like this:
Also I've tried to execute the bind with other jquery options and I'm obtainning the same result:
Any idea what should I do? I continue investigating.
Thanks for your help.
At my end the textbox is found on opening the Window and its autocomplete attribute is successfully set to "off". See this screencast. The sample runnable project I tested this in is attached to this reply. Could you modify it accordingly reproducing the issue in it and attach it back for further review?
Looking your code I've seen the difference. Before call the function to add the autocomplete you are openning the window and hidding it:
After you set the autocomplete:
If we don't do the first doesn't works, that's my case, the function was called but the autocomplete was not setted because the object is not rendered yet.
Would be nice an event that it's executed when the window it's fully loaded to don't have to work with windows inside divs and works hidding/showing them, for me it's not pretty cool, moreover I should change a lot of code.
Thanks for your time.
Actually the Window is initially hidden through configuration:
What this code:
does is it opens the Window on clicking the button and hides the button with id "undo", not the the Window. So the hide() and show() methods are used for the hiding/showing the button.
As for an event that fires when the Window loads its content, at the moment such event is not exposed. You could consider using a timeout in the Window's open event to delay setting the attributes a little bit.