1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Display a model form before saving

Discussão em 'PSDN - Forum' iniciado por ByronB, Fevereiro 10, 2015.

  1. ByronB

    ByronB Guest

    On saving of an edit form I would like to stop the form submission until a model result has taken place. Basically I need to check a few things and present the user with an option to proceed or cancel out (stopping the form submission).

    I am using the JqueryUi dialog Model Confirmation (eg):

    <script>
    function fnOpenNormalDialog() {
    $("#dialog-confirm").html("Confirm Dialog Box");

    // Define the Dialog and its properties.
    $("#dialog-confirm").dialog({
    resizable: false,
    modal: true,
    title: "Modal",
    height: 250,
    width: 400,
    buttons: {
    "Yes": function () {
    $(this).dialog('close');
    callback(true);
    },
    "No": function () {
    $(this).dialog('close');
    callback(false);
    }
    }
    });
    }

    $('#btnOpenDialog').click(fnOpenNormalDialog);

    function callback(value) {
    if (value) {
    alert("Confirmed");
    } else {
    alert("Rejected");
    }
    }
    </script>

    Form submission should only happen after the model result (ok). How best to intercept the submit until a model result?

    If confirmed I want to trigger with form submission but if cancelled then stop the form submission so the user can change what they need to before re submitting.

    Continue reading...

Compartilhe esta Página