<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV></DIV>
<DIV>Well, I will be the lone wolf here I guess. The "standard Drupal" way is to use the delete_confirm dialog API, which you can find documented in <A href="http://api.drupal.org">http://api.drupal.org</A>.</DIV>
<DIV> </DIV>
<DIV>Have you even tried a search on drupal.org? I am certain that you would find your answers there.<BR> </DIV>
<P><FONT color=#ff007f size=4 face="bookman old style, new york, times, serif"><EM><STRONG>Nancy</STRONG></EM></FONT></P>
<P><FONT face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</FONT></P>
<DIV><BR></DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 12pt"><BR>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><FONT size=2 face=Tahoma>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> mahesh gajabar <mahesh143an@gmail.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> development@drupal.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wed, January 12, 2011 1:37:59 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> [development] creating pop-up window for delete and edit actions in table in module file<BR></FONT><BR>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-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal align=center><B><SPAN style="FONT-SIZE: 12pt">SlNo</SPAN></B></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal align=center><B><SPAN style="FONT-SIZE: 12pt">Doctor Name</SPAN></B></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal align=center><B><SPAN style="FONT-SIZE: 12pt">Gender</SPAN></B></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal align=center><B><SPAN style="FONT-SIZE: 12pt">Status</SPAN></B></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal align=center><B><SPAN style="FONT-SIZE: 12pt">Action</SPAN></B></P></TD></TR></THEAD>
<TBODY>
<TR>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">2</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">Jayaram Srinivasan</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">male</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">inactive</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt"><A href="http://localhost/fr/doctor/edit/2" rel=nofollow target=_blank><SPAN style="COLOR: blue">Edit</SPAN></A> |<A href="http://localhost/fr/doctor/delete/2" rel=nofollow target=_blank><SPAN style="COLOR: blue"> Delete</SPAN></A></SPAN></P></TD></TR>
<TR>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">3</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">Pavithra M</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">female</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">active</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt"><A href="http://localhost/fr/doctor/edit/3" rel=nofollow target=_blank><SPAN style="COLOR: blue">Edit</SPAN></A> |<A href="http://localhost/fr/doctor/delete/3" rel=nofollow target=_blank><SPAN style="COLOR: blue"> Delete</SPAN></A></SPAN></P></TD></TR>
<TR>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">4</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">Ravi Mandayam</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">male</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt">active</SPAN></P></TD>
<TD style="PADDING-BOTTOM: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-RIGHT: 0.75pt; PADDING-TOP: 0.75pt">
<P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal><SPAN style="FONT-SIZE: 12pt"><A href="http://localhost/fr/doctor/edit/4" rel=nofollow target=_blank><SPAN style="COLOR: blue">Edit</SPAN></A> |<A href="http://localhost/fr/doctor/delete/4" rel=nofollow 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 value=1 type=hidden name=confirm>
<DIV><INPUT value=Delete type=submit name=op> <A href="http://localhost/fr/doctor" rel=nofollow 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 value=jayaram maxLength=128 size=60 name=firstname> </DIV>
<DIV><LABEL>Last Name: </LABEL><INPUT value=srinivasan maxLength=128 size=60 name=lastname> </DIV>
<DIV><LABEL>Gender: </LABEL>
<DIV>
<DIV><LABEL><INPUT value=0 CHECKED type=radio name=gender> male</LABEL> </DIV>
<DIV><LABEL><INPUT value=1 type=radio name=gender> female</LABEL> </DIV></DIV></DIV>
<DIV><LABEL>Status: </LABEL>
<DIV>
<DIV><LABEL><INPUT value=0 type=radio name=status> active</LABEL> </DIV>
<DIV><LABEL><INPUT value=1 CHECKED type=radio name=status> inactive</LABEL> </DIV></DIV></DIV><INPUT value=1 type=hidden name=confirm>
<DIV><INPUT value=Save type=submit name=op> <A href="http://localhost/fr/doctor" rel=nofollow 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></DIV></DIV></div></body></html>