Yii Framework Forum: Confirmation Dialog After Save The Data - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Confirmation Dialog After Save The Data I need to add the dialog box to getting confirm from user to print Rate Topic: -----

#1 User is offline   Bucephaluz 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 30-November 12
  • Location:India

Posted 19 July 2013 - 04:42 PM

Hi,

I have no idea about it, please help me to do this task well.

Just i want to save the data in to table, after i saved the data, i need to show the dialog to user, to get the confirmation to print the data, whether its may be, yes or no, then i will redirect it appropriate url to print or end.

Please help me

Thanks

Dharma
0

#2 User is offline   FreeScott 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 31-December 12

Posted 22 July 2013 - 01:44 PM

You should provide more details to get a clear solution! Anyway I suppose you're using ajax to save this data, so you just need to put some javascript code into your view to do the magic:

<?php
Yii::app()->getClientScript('saveAndRedirect', '
   jQuery(function(){
      $("#xyz").on("submit", "function(event){
         event.preventDefault();
         $.ajax({
            type: "POST",
            data: $(this).serialize(),
            url: "example.com/save",
            success: function(){
               if(confirm("print?"))
                  window.location="example.com/print"
               else
                  window.location="example.com/end"
            },
            error: function(){
               alert("sth went wrong!");
            }
         });
      }");
   })
', CClientScript::POS_END);
?>

<form id="xyz">
   <!-- your input fields -->
</form>

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users