Hello,
For a custom plugin I have a new toolbar button and a popup, which opens when clicking on the toolbar button. I also enabled the OK button in the popup. My problem is that I don't want to submit the data and close the popup when the user is hitting Enter.
My solution of solving this would be to check in the Ok function, if the event.keyCode is 13 simply return false and the Ok doesn't terminate successfully. However I don't have any idea on how to access the event. This doesn't work:
Any help would be appreciated?
Thank you in advance.
Stephan
For a custom plugin I have a new toolbar button and a popup, which opens when clicking on the toolbar button. I also enabled the OK button in the popup. My problem is that I don't want to submit the data and close the popup when the user is hitting Enter.
My solution of solving this would be to check in the Ok function, if the event.keyCode is 13 simply return false and the Ok doesn't terminate successfully. However I don't have any idea on how to access the event. This doesn't work:
// the OK button was hit function Ok() { var e = FCK.EditorWindow.event; if (e && e.keyCode == 13) return false ; get some formular data, and save it to the FCK Main window with FCK.InsertElement( oElement ); return true; }
Any help would be appreciated?
Thank you in advance.
Stephan
Re: Prevent Popup submit when hiting enter
patching the fck_dialog.html solved the problem. If the event for a keydown is called and the enter button was hit the Ok() function is called. Now the Ok function simply gets a parameter submited that is true in this case. This must be checked in the custom function in the plugin. My function looks like this now:
The diff of my patch to the original fck_dialog.html of version 2.6.4. looks like this:
You will not get into this trouble if this happens in a textarea. There everything is fine, just on simple input fields or even if no field has the input focus the behaviour is observed.
Though I would have liked a solution without patching the FCK sources this seemed the only way to go.
Best regards, Stephan