ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
PopupForm buttons events
Title:
B
I
{code}
?
With .Success I can bind a function after OK press, but is it possible to bind Before this event ? and also is it possible to bind to CANCEL button ?
Save Changes
Cancel
mtugnoli
asked at 18 Mar 2014
success is on form submit success, when the post action returns a json; there's no event before okpress, and you can't bind to cancel button; but you can set .UseDefaultButtons(false) and add your own buttons like here: http://demo.aspnetawesome.com/WizardDemo
at 18 Mar 2014
Omu
Very good... I can use this for OK buttom, <input type="submit" value="OK" class="awe-btn" onclick="$('#wizardData form').submit()" style="width: 100px;" /> but for CANCEL button ?
at 18 Mar 2014
mtugnoli
you can see this here: http://demo.aspnetawesome.com/PopupDemo "Popup with buttons" has a close button, just do the same
at 19 Mar 2014
Omu
it is not ok for me... I need an event before closing not after. I use this in a PopUp Form to send an email message. in this form there are some textbox with TO,SUBJECT,and BODY, there is also a <UI> whith <LI> foreach file attached. If press cancel, I have to delete all files attached, if I press ok, I have to send the messsage. in http://demo.aspnetawesome.com/PopupDemo i can do custom buttons, but if press cancel, I can't get html source from popup window, because event fire AFTER popup is closed.
at 20 Mar 2014
mtugnoli
in that page you have this js function function closePopup() { $(this).dialog('close'); } which is used by the popup like this: .Button("Close", "closePopup") which does the closing, so you can write any custom code you need before the $(this).dialog('close'); you can also use .Close("onClose") and write js code in there, you can still access the content of the popup via $(this) or $('#idofthepopup')
at 20 Mar 2014
Omu
OK for closing is ok, but for SEND button, I have a little problem, onClose event fire like CANCEL button, so how can I know in onclose event if I press CANCEL,SEND or top-right (X) close icon ? I do like this.. .UseDefaultButtons(false).Button("Cancel", "closePopup").Button("Send", "sendMail").Close("onClose function sendMail() { DoSomethigBefore(); $('#CreateMail').submit(); } function closePopup() { $(this).dialog('close'); } function onClose() { alert($('#NewMailPopup').find("ul li").length); }
at 20 Mar 2014
mtugnoli
guess in your close func you can set $(this).data('btnused', 'close'); and check for .data('btnused') in onClose
at 20 Mar 2014
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK