Hi,<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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";"><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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";"><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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";">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: "Times New Roman","serif";"><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><?php<br><br>function doctor_menu() {<br> $items = array();<br>
<br> $items['doctor'] = array(<br> 'title' => t('Doctors'),<br> 'page callback' =>'doctors_list',<br> 'access arguments' => array('access doctor'),<br>
'type' => MENU_NORMAL_ITEM,<br> );<br> <br> $items['doctor/delete/%doctor_user'] = array(<br> 'title' => t('Delete doctor'),<br> 'page callback' => 'drupal_get_form',<br>
'page arguments' => array('doctor_delete_confirm', 2),<br> 'access arguments' => array('access doctor'),<br> 'type' => MENU_CALLBACK,<br> );<br> $items['doctor/edit/%doctor_user'] = array(<br>
'title' => t('Edit Form'),<br> 'page callback' => 'drupal_get_form',<br>'page arguments' => array('doctor_edit_confirm', 2),<br> 'access arguments' => array('access doctor'),<br>
'type' => MENU_NORMAL_ITEM,<br> );<br> return $items;<br>}<br><br>function doctors_list() {<br> $header = array(t(Sl.No),t('Doctor Name'), t('Gender'), t('Status'), t('Action'));<br>
<br> $query = "SELECT * FROM {doctor}";<br> $rs = db_query($query);<br> <br> $row = array();<br> <br> if ($rs) {<br> while ($data = db_fetch_object($rs)) {<br> $doctorid = $data->doctorid;<br>
$gender = $data->gender;<br> $status = $data->status ;<br> $row[] = array($doctorid,stripslashes(ucwords($data->firstname)) . ' ' . stripslashes(ucwords($data->lastname)), $gender, $status, <br>
"<a href='doctor/edit/{$data->doctorid}'>" . t('Edit') . "</a> |<a href='doctor/delete/{$data->doctorid}'> ". t('Delete')."</a>" );<br>
}<br> }<br> <br> $str .= theme_table($header, $row);<br> <br> return $str;<br>}<br>function doctor_user_load($doctorid) {<br> $query = "SELECT * FROM {doctor} WHERE doctorid = %d";<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(&$form_state, $doctor) {<br> $form['_doctor'] = array(<br> '#type' => 'value',<br> '#value' => $doctor,<br> );<br> <br>
return confirm_form($form,<br> t('Are you sure you want to delete this doctor?'),<br> isset($_GET['destination']) ? $_GET['destination'] : "doctor",<br> t('This action cannot be undone.'),<br>
t('Delete'),<br> t('Cancel'));<br>}<br><br>function doctor_delete_confirm_submit($form, &$form_state) {<br> $form_values = $form_state['values'];<br> <br> if ($form_state['values']['confirm']) {<br>
$doctor = $form_state['values']['_doctor'];<br> <br> $query = "DELETE FROM {doctor} where doctorid= $doctor->doctorid";<br>
$rs = db_query($query);<br>drupal_set_message(t('Doctor has been deleted successfully.'));<br> } drupal_goto("doctor");<br>}<br><br>function doctor_edit_confirm(&$form_state,$doctor){<br>
$form = array();<br>$form['_doctors'] = array(<br> '#type' => 'value',<br> '#value' => $doctor,<br> );<br><br>$query = "SELECT * FROM {doctor} where doctorid=%d";<br>
$rs = db_query($query,$doctor->doctorid);<br>$data=db_fetch_object($rs);<br>$firstname=$data->firstname;<br>$lastname=$data->lastname;<br>$gender1 = $data->gender;<br>$gender = $gender1 ? 0: 1;<br>$status1 = $data->status ;<br>
$status = $status1 ? 1: 0;<br>$form['firstname']=array(<br> '#title'=>t('First Name'),<br> '#type'=>'textfield',<br> '#default_value'=>$data->firstname,<br>
<br> );<br>$form['lastname']=array(<br> '#title'=>t('Last Name'),<br> '#type'=>'textfield',<br> '#default_value' => $lastname,<br>
);<br>$form['gender']=array(<br> '#title'=>t('Gender'),<br> '#type'=>'radios',<br> <br> '#options' => array(t('male'), t('female')),<br>
'#default_value' => variable_get('gender',$gender),<br> );<br>$form['status']=array(<br> '#title'=>t('Status'),<br> '#type'=>'radios',<br>
'#options' => array(t('active'), t('inactive')),<br> '#default_value' => variable_get('status',$status),<br> <br>
);<br> <br>return confirm_form($form,t(''),<br> isset($_GET['destination']) ? $_GET['destination'] : "doctor",<br> t(''),<br> t('Save'),<br> t('Cancel'));<br>
}<br><br>function doctor_edit_confirm_submit($form, &$form_state)<br>{<br>if ($form_state['values']['confirm']) {<br>$doctor = $form_state['values']['_doctors'];<br>$form_state['values']['doctorid'] = $doctor->doctorid;<br>
$firstname = $form_state['values']['firstname'];<br> $lastname = $form_state['values']['lastname'];<br> $gender1= $form_state['values']['gender'];<br>$gender = $gender1 ? t('female') : t('male');<br>
$status1 = $form_state['values']['status'];<br>$status = $status1 ? t('inactive') : t('active');<br>$query = "UPDATE {doctor} SET firstname = '$firstname', lastname= '$lastname', gender = '$gender', status = '$status' WHERE doctorid=%d";<br>
$rs = db_query($query,$doctor->doctorid); }<br>drupal_goto("doctor");<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>