Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation fields #2

Open
alvisir opened this issue Aug 11, 2014 · 4 comments
Open

Validation fields #2

alvisir opened this issue Aug 11, 2014 · 4 comments

Comments

@alvisir
Copy link

alvisir commented Aug 11, 2014

Hi,
is it possible to add a simple validation to fields value in the TinyMCE popup before submit?
My scenario: I add a button that opens a popup with a text input field. If it is empty when I submit, an alert appears and the popup doesn't close. If the value is correct then the popup closes.

Thanks in advance

@dziudek
Copy link
Contributor

dziudek commented Aug 11, 2014

Hello,

Unfortunately I afraid that blocking the popup closing is not possible

@alvisir
Copy link
Author

alvisir commented Aug 13, 2014

I found a solution adding e.preventDefault(); after the submit event and editor.windowManager.close(); to force close the window.

onsubmit: function(e) {
        e.preventDefault();

        // validation

       // if the text field is not empty
       editor.windowManager.close();
}

@dziudek
Copy link
Contributor

dziudek commented Aug 13, 2014

e.preventDefault();

is working for you? I thought about the same solution, but when I've checked out it doesn't worked properly so I thought that it is not working this way - thank you for this information :)

@vitorcoxta
Copy link

3 years later, this helped me, since I found no way to do it on a native way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants