Consider <a href="http://drupal.org/project/popups">http://drupal.org/project/popups</a><br><br><div class="gmail_quote">On Tue, Jan 11, 2011 at 11:37 PM, mahesh gajabar <span dir="ltr">&lt;<a href="mailto:mahesh143an@gmail.com">mahesh143an@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<div><div></div><div class="h5"><br><div class="gmail_quote">I have written a custome module table for showing some information which is fetched from database and every row is having edit and delete actions. Both are working fine. But whenever I click on on edit or delete action action it opens in other window leaving current page. I want these actions to be taken place in pop-up window. <br>


<br>My table on drupal screen is as follows<br><br>

<table border="0" cellpadding="0">
 <thead>
  <tr>
   <td style="padding:0.75pt">
   <p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:center;line-height:normal" align="center"><b><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">SlNo</span></b></p>


   </td>
   <td style="padding:0.75pt">
   <p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:center;line-height:normal" align="center"><b><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">Doctor
   Name</span></b></p>
   </td>
   <td style="padding:0.75pt">
   <p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:center;line-height:normal" align="center"><b><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">Gender</span></b></p>


   </td>
   <td style="padding:0.75pt">
   <p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:center;line-height:normal" align="center"><b><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">Status</span></b></p>


   </td>
   <td style="padding:0.75pt">
   <p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:center;line-height:normal" align="center"><b><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">Action</span></b></p>


   </td>
  </tr>
 </thead>
 <tbody><tr>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">2</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">Jayaram Srinivasan</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">male</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">inactive</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><a href="http://localhost/fr/doctor/edit/2" target="_blank"><span style="color:blue">Edit</span></a>
  |<a href="http://localhost/fr/doctor/delete/2" target="_blank"><span style="color:blue">
  Delete</span></a></span></p>
  </td>
 </tr>
 <tr>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">3</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">Pavithra M</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">female</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">active</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><a href="http://localhost/fr/doctor/edit/3" target="_blank"><span style="color:blue">Edit</span></a>
  |<a href="http://localhost/fr/doctor/delete/3" target="_blank"><span style="color:blue">
  Delete</span></a></span></p>
  </td>
 </tr>
 <tr>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">4</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">Ravi Mandayam</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">male</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">active</span></p>
  </td>
  <td style="padding:0.75pt">
  <p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><a href="http://localhost/fr/doctor/edit/4" target="_blank"><span style="color:blue">Edit</span></a>
  |<a href="http://localhost/fr/doctor/delete/4" target="_blank"><span style="color:blue">
  Delete</span></a></span></p>
  </td>
 </tr>
</tbody></table>

<br>when i click delete button i should get pop-up window with the dialogue like this;<br><br><h2>Are You Sure You Want To Delete This Doctor?</h2>                                        
This action cannot be undone.<input name="confirm" value="1" type="hidden">
<div><input name="op" value="Delete" type="submit">
<a href="http://localhost/fr/doctor" target="_blank">Cancel</a><br><br>When I click edit button I should get my edit form,<br><span><div></div></span>                                                        
<div>
 <label>First Name: </label>
 <input maxlength="128" name="firstname" size="60" value="jayaram" type="text">
</div>
<div>
 <label>Last Name: </label>
 <input maxlength="128" name="lastname" size="60" value="srinivasan" type="text">
</div>
<div>
 <label>Gender: </label>
 <div><div>
 <label><input name="gender" value="0" checked type="radio"> male</label>
</div>
<div>
 <label><input name="gender" value="1" type="radio"> female</label>
</div>
</div>
</div>
<div>
 <label>Status: </label>
 <div><div>
 <label><input name="status" value="0" type="radio"> active</label>
</div>
<div>
 <label><input name="status" value="1" checked type="radio"> inactive</label>
</div>
</div>
</div>
<input name="confirm" value="1" type="hidden">
<div><input name="op" value="Save" type="submit">
<a href="http://localhost/fr/doctor" target="_blank">Cancel</a></div> <br>complete code of my module file is as follows:<br><br><i style="font-family:verdana,sans-serif"><b>&lt;?php<br><br>function doctor_menu() {<br>  $items = array();<br>


 <br>  $items[&#39;doctor&#39;] = array(<br>    &#39;title&#39; =&gt; t(&#39;Doctors&#39;),<br>    &#39;page callback&#39; =&gt;&#39;doctors_list&#39;,<br>    &#39;access arguments&#39; =&gt; array(&#39;access doctor&#39;),<br>


    &#39;type&#39; =&gt; MENU_NORMAL_ITEM,<br>  );<br> <br>  $items[&#39;doctor/delete/%doctor_user&#39;] = array(<br>    &#39;title&#39; =&gt; t(&#39;Delete doctor&#39;),<br>    &#39;page callback&#39; =&gt; &#39;drupal_get_form&#39;,<br>


    &#39;page arguments&#39; =&gt; array(&#39;doctor_delete_confirm&#39;, 2),<br>    &#39;access arguments&#39; =&gt; array(&#39;access doctor&#39;),<br>    &#39;type&#39; =&gt; MENU_CALLBACK,<br>  );<br> $items[&#39;doctor/edit/%doctor_user&#39;] = array(<br>


    &#39;title&#39; =&gt; t(&#39;Edit Form&#39;),<br>    &#39;page callback&#39; =&gt; &#39;drupal_get_form&#39;,<br>&#39;page arguments&#39; =&gt; array(&#39;doctor_edit_confirm&#39;, 2),<br>   &#39;access arguments&#39; =&gt; array(&#39;access doctor&#39;),<br>


    &#39;type&#39; =&gt; MENU_NORMAL_ITEM,<br>  );<br>  return $items;<br>}<br><br>function doctors_list() {<br>    $header = array(t(Sl.No),t(&#39;Doctor Name&#39;), t(&#39;Gender&#39;),  t(&#39;Status&#39;), t(&#39;Action&#39;));<br>


 <br>    $query = &quot;SELECT * FROM {doctor}&quot;;<br>    $rs = db_query($query);<br> <br>    $row = array();<br> <br>    if ($rs) {<br>        while ($data = db_fetch_object($rs)) {<br>                                                      $doctorid = $data-&gt;doctorid;<br>


            $gender = $data-&gt;gender;<br>            $status = $data-&gt;status ;<br>            $row[] = array($doctorid,stripslashes(ucwords($data-&gt;firstname)) . &#39; &#39; . stripslashes(ucwords($data-&gt;lastname)), $gender, $status, <br>


            &quot;&lt;a href=&#39;doctor/edit/{$data-&gt;doctorid}&#39;&gt;&quot; . t(&#39;Edit&#39;) .  &quot;&lt;/a&gt; |&lt;a href=&#39;doctor/delete/{$data-&gt;doctorid}&#39;&gt; &quot;. t(&#39;Delete&#39;).&quot;&lt;/a&gt;&quot; );<br>


        }<br>    }<br> <br>    $str .= theme_table($header, $row);<br> <br>    return $str;<br>}<br>function doctor_user_load($doctorid) {<br>    $query = &quot;SELECT * FROM {doctor} WHERE doctorid = %d&quot;;<br>    $rs = db_query($query, $doctorid);<br>


 <br>    if ($rs) {<br>        while ($data = db_fetch_object($rs)) {<br>            return $data;<br>        }<br>    }<br> <br>    return FALSE;<br>}<br><br>function popup()<br>{<br>window.confirm();<br>return false;<br>


}<br><br>function doctor_delete_confirm(&amp;$form_state, $doctor) {<br>    $form[&#39;_doctor&#39;] = array(<br>        &#39;#type&#39; =&gt; &#39;value&#39;,<br>        &#39;#value&#39; =&gt; $doctor,<br>    );<br> <br>


    return confirm_form($form,<br>        t(&#39;Are you sure you want to delete this doctor?&#39;),<br>        isset($_GET[&#39;destination&#39;]) ? $_GET[&#39;destination&#39;] : &quot;doctor&quot;,<br>        t(&#39;This action cannot be undone.&#39;),<br>


        t(&#39;Delete&#39;),<br>        t(&#39;Cancel&#39;));<br>}<br><br>function doctor_delete_confirm_submit($form, &amp;$form_state) {<br>    $form_values = $form_state[&#39;values&#39;];<br> <br>    if ($form_state[&#39;values&#39;][&#39;confirm&#39;]) {<br>


        $doctor = $form_state[&#39;values&#39;][&#39;_doctor&#39;];<br>                                      <br>                                     $query = &quot;DELETE  FROM {doctor} where doctorid= $doctor-&gt;doctorid&quot;;<br>


                       $rs = db_query($query);<br>drupal_set_message(t(&#39;Doctor has been deleted successfully.&#39;));<br>      }  drupal_goto(&quot;doctor&quot;);<br>}<br><br>function doctor_edit_confirm(&amp;$form_state,$doctor){<br>


 $form = array();<br>$form[&#39;_doctors&#39;] = array(<br>        &#39;#type&#39; =&gt; &#39;value&#39;,<br>                                     &#39;#value&#39; =&gt; $doctor,<br>        );<br><br>$query = &quot;SELECT * FROM {doctor} where doctorid=%d&quot;;<br>


    $rs = db_query($query,$doctor-&gt;doctorid);<br>$data=db_fetch_object($rs);<br>$firstname=$data-&gt;firstname;<br>$lastname=$data-&gt;lastname;<br>$gender1 = $data-&gt;gender;<br>$gender = $gender1 ? 0: 1;<br>$status1 = $data-&gt;status ;<br>


$status = $status1 ? 1: 0;<br>$form[&#39;firstname&#39;]=array(<br>        &#39;#title&#39;=&gt;t(&#39;First Name&#39;),<br>        &#39;#type&#39;=&gt;&#39;textfield&#39;,<br>                                   &#39;#default_value&#39;=&gt;$data-&gt;firstname,<br>


                                    <br>  );<br>$form[&#39;lastname&#39;]=array(<br>        &#39;#title&#39;=&gt;t(&#39;Last Name&#39;),<br>        &#39;#type&#39;=&gt;&#39;textfield&#39;,<br>                                     &#39;#default_value&#39; =&gt; $lastname,<br>


    );<br>$form[&#39;gender&#39;]=array(<br>        &#39;#title&#39;=&gt;t(&#39;Gender&#39;),<br>        &#39;#type&#39;=&gt;&#39;radios&#39;,<br>                                   <br>                                   &#39;#options&#39; =&gt; array(t(&#39;male&#39;), t(&#39;female&#39;)),<br>


                                     &#39;#default_value&#39; =&gt; variable_get(&#39;gender&#39;,$gender),<br>    );<br>$form[&#39;status&#39;]=array(<br>        &#39;#title&#39;=&gt;t(&#39;Status&#39;),<br>        &#39;#type&#39;=&gt;&#39;radios&#39;,<br>


                               &#39;#options&#39; =&gt; array(t(&#39;active&#39;), t(&#39;inactive&#39;)),<br>                                &#39;#default_value&#39; =&gt; variable_get(&#39;status&#39;,$status),<br>                                      <br>


    );<br>    <br>return confirm_form($form,t(&#39;&#39;),<br>        isset($_GET[&#39;destination&#39;]) ? $_GET[&#39;destination&#39;] : &quot;doctor&quot;,<br>        t(&#39;&#39;),<br>        t(&#39;Save&#39;),<br>        t(&#39;Cancel&#39;));<br>


}<br><br>function doctor_edit_confirm_submit($form, &amp;$form_state)<br>{<br>if ($form_state[&#39;values&#39;][&#39;confirm&#39;]) {<br>$doctor = $form_state[&#39;values&#39;][&#39;_doctors&#39;];<br>$form_state[&#39;values&#39;][&#39;doctorid&#39;] = $doctor-&gt;doctorid;<br>


 $firstname = $form_state[&#39;values&#39;][&#39;firstname&#39;];<br>    $lastname = $form_state[&#39;values&#39;][&#39;lastname&#39;];<br>    $gender1= $form_state[&#39;values&#39;][&#39;gender&#39;];<br>$gender =  $gender1 ? t(&#39;female&#39;) : t(&#39;male&#39;);<br>


    $status1 = $form_state[&#39;values&#39;][&#39;status&#39;];<br>$status = $status1 ? t(&#39;inactive&#39;) : t(&#39;active&#39;);<br>$query = &quot;UPDATE  {doctor} SET firstname = &#39;$firstname&#39;, lastname= &#39;$lastname&#39;,  gender = &#39;$gender&#39;, status = &#39;$status&#39;  WHERE  doctorid=%d&quot;;<br>


 $rs = db_query($query,$doctor-&gt;doctorid); }<br>drupal_goto(&quot;doctor&quot;);<br>}<br><br></b></i><span style="font-family:verdana,sans-serif">Any help appreciated.</span><i style="font-family:verdana,sans-serif"><b><br>


<br></b></i></div><i style="font-family:verdana,sans-serif"><b>Regards,</b></i><br><font color="#888888">Mahesh Gajabar<br>
</font></div><br>
</div></div></blockquote></div><br>