How to prevent editor open form?
How to prevent editor open form?
vincmeister
Posts: 136Questions: 36Answers: 4
in Editor
Hi Allan,
I want to prevent open editor in some conditions.
I'm using editor.close() , but i think this is not smooth. Is there any way to prevent editor open ? Please advise, thank you
This question has accepted answers - jump to:
This discussion has been closed.
Answers
You can use the
preOpen
event. Returning false will stop the open operation.@rduncecb thanks for the reply bu I don't want the editor open. If using return false, the form still open, but prevent update.
Thanks
@rduncecb is correct -
preOpen
can be used to stop the editor window from opening at all. Returning call from that event handler should stop the window from showing.Alternatively, you could use the optional second parameter of
edit()
to not show the form.Allan
Hi Allan,
Here's my code. But return false not working to prevent form open. Please advise, thank you.
It's not working because you're returning the value from the ajax callback, this does not return a value from your preOpen event handler, the end of the function is reached BEFORE your ajax call (and does not return a value) as the process is asynchronous.
@rduncecb thanks for the explanation. so how to make it happen? Please help thank you
You would have to move the
return false;
to thepreOpen
event handler (i.e. line 23-24 above).You could then use
open()
to display the form if it should be shown in the Ajax handler.Allan
thanks @rduncecb & @allan for the explanation