title: Confirmation Dialog in Zend Framework
body: <p>I'm building a Zend Application using doctrine repository classes to update, delete and insert data to the DB. These repositories are called from controller actions and they do exactly what they supposed to do. However, I'd like to add some confirmation dialogs to the application, so for example, if a user wants to edit or delete an item, a Confirm Edit or Delete dialog must first be opened and the data will be edited or deleted depending on what the user selects. Here's an example of some action code for updating a staff members details after the user has clicked on a zend form submit button.</p>
  
  <pre><code>public function updatestaffAction()
  {        
      if ($this-&gt;getRequest()-&gt;isPost()) {
          if ($form-&gt;isValid($this-&gt;getRequest()-&gt;getPost())) {
              $values = $form-&gt;getValues();
              $user = $this-&gt;entityManager-&gt;find('\PTS\Entity\Staff', $values['staff_number']);
              $staffValues = array('staff_number' =&gt;  $values['staff_number'],
                                   'title'        =&gt;  $values['title'],
                                   'first_name'   =&gt;  $values['first_name'],
                                   'last_name'    =&gt;  $values['last_name'],
                                   'telephone'    =&gt;  $values['telephone'],
                                   'cellphone'    =&gt;  $values['cellphone'],
                                   'fax'          =&gt;  $values['fax'],
                                   'email'        =&gt;  $values['email'],
                                   'job_title'    =&gt;  $values['job_title']);
  
              $this-&gt;staffRepository-&gt;saveStaff($staffValues);
              $this-&gt;entityManager-&gt;flush();
          }
      }
  </code></pre>
  
  <p>The staff repository saveStaff method simply creates a new Staff object and persists that object if the staff member doesn't exists, or merges the new data if it's an existing staff member as is the case for the update code above.</p>
  
  <p>So my question is, how can I change the action to only save the data once the user has clicked the yes button in a confirmation dialog. BTW, the dialog can be either a JQuery or Dojo dialog box.</p>