We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Redirect back to modal

i have a form in modal and after submission i validate the data , how can i redirect back to the modal if validation fails...? Please help..!!!!


Because i have no idea what packages you are using, here is an bootstrap example that should do the trick

    var $modal = $("#myModal");
    if (document.location.hash === "invalidRegisterForm"){
        $modal.modal("open"); // check this cuz i have forgotten how exactly was the bootstrap API

in the controller you need to redirect to something like this


edited Apr '17

or another was is in volt or whatever

if false === form.isValid() {
    <script type="text/javascript>
        var modal .. modal.open()

but putting form in modals is one of the stupidiest ideas I have ever came up with :D