javascript - jquery dialog widget not passing my form value -
i have table image bellow create query databases, each row have button when onclick prompt dialog box (i use jquery dialog widget)
this myform html code
<form action="prodi_tampil_mhs.php" method="post" name="form_tambah_cl_wisudawan" id="form_tambah_cl_wisudawan">
this php code create table query database
while ($fetch_dbsi_mhsw=mysql_fetch_array($query_dbsi_mhsw)) { $no++; echo" <tr> <td>$no</td> <td>$fetch_dbsi_mhsw[nim]</td> <td>$fetch_dbsi_mhsw[name]</td> <td style=\"text-align: center;\"><input name=\"bt_tambah_calon_wisudawan\" id=\"bt_tambah_calon_wisudawan\" type=\"image\" src=\"buttontambah.png\" alt=\"tambah\" align=\"middle\" width=\"20\" height=\"20\" class=\"bt_tambah_calon_wisudawan\" /></td></tr>";}
and jquery code
$(document).ready(function(){ $(".bt_tambah_calon_wisudawan").click(function(){ var value1 = $(this).closest('tr').find('td:eq(1)').text(); var value2 = $(this).closest('tr').find('td:eq(2)').text(); // here's text of dialog box var dialog = $("<div style='display: none'><p>anda akan menambahkan "+value1 + " " + value2 + " sebagai calon wisudawan?</p></div>").appendto("body"); // button on form var form = $("#form_tambah_cl_wisudawan") // form button pressed - open dialog $(dialog).dialog({ title: "konvirmasi penambahan data", dialogclass: "no-close", width: 600, modal: true, buttons: { "tambah": function () { // invoke form's action - putatively deleting resources on server $(form).submit(); $(this).dialog("close"); }, "cancel": function() { // don't invoke action, close dialog $(this).dialog("close"); } } }); return false; }); });
my dialog box appear (like image 2)
when click button "tambah" in dialog box value in form not passing. mistake in jquery code? help?
replace $(form).submit();
form.submit();
have stored selector $("#form_tambah_cl_wisudawan")
var form
.
Comments
Post a Comment