0

Suppose a parent window opens a popup window, and from there I do some character count validation. The character count function should be triggered only when I close the window. If the character count is below the limit, it should close normally otherwise it should display the editor with the content so that the user can work on reducing the character count and then submit back to parent window.

FYI I'm using Kevin Roth's Cross-browser editor

Thanks in Advance

1 Answers1

0

You can write a function to do some character count validation. If pass, invoke method to close popup window in this function. Then, set this function as the handler to listen click event of close button .

For example, I use jQuery UI dialog as popup window.

    <div id="popup">
        <!--popup window content-->
        <button id="save">Save</button
    </div>

    <script>
        $("#popup").dialog({
            ...
        });

        var save = function() {
            var isValidated = false;  // true means passed.

            //...validation here

            if (validated) {
                $("#popup").dialog("close");
            } else {
                // show some message and focus on the editor
            }

        };
    </script>
Ardy
  • 161
  • 3