Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting data from Modal forms before it closes

I have a Modal form, and in the Ok button it processes some information, that I need in the form that called the modal form.

How can I get it out before it closes?

Or delay the close till I say it can close.

like image 870
DRokie Avatar asked Oct 19 '11 12:10

DRokie


People also ask

How do I get the value from modal popup?

If user click the hyperlink <a>See Milk</a> from the primary form, then will showing a JQuery Modal Dialog. Then if the option list are selected from the Modal Dialog & click Submit, it should closing the Modal Dialog & showing the value on the input type at primary form.

How do you keep a modal open?

$(document). ready(function () { $("#myModal"). modal('show'); }); and write your html code in update panel then remove data-dismiss="modal" from the button.

How do you reset the modal when it gets closed and open it fresh again?

How do you reset the Bootstrap modal when it gets closed and open it fresh again? The Best Answer is reset is dom build-in funtion, you can also use $(this). find('form')[0]. reset(); And Bootstrap's modal class exposes a few events for hooking into modal functionality, detail at here.

How can pass data from modal to button?

When the submit button is clicked, it invokes the jQuery function. The data entered the text area is extracted using the val() method into the text variable. This text string is passed to the modal body using the html() method of jQuery.


1 Answers

I expect that your OK button has ModalResult set to mrOK. If you want to add error checking to the OK button then change that to mrNone. Add an OnClick handler to the button which does whatever checking or processing you need. If it determines that the form can close, set Self.ModalResult := mrOK in the OnClick handler.

like image 193
David Heffernan Avatar answered Sep 18 '22 06:09

David Heffernan