dongtun3328 2015-07-27 12:15
浏览 23

jquery对话框小部件未传递我的表单值

i have table like image bellow where i create from query to databases, each row have button when onclick will be prompt dialog box (i use jquery dialog widget) image 1

this myform html code

<form action="prodi_tampil_mhs.php" method="post" name="form_tambah_cl_wisudawan" id="form_tambah_cl_wisudawan">

this my php code where i create the table from 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 my 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 the text of the dialog box 
        var dialog = $("<div style='display: none'><p>Anda akan menambahkan "+value1 + " " + value2 + " sebagai calon wisudawan?</p></div>").appendTo("body");
        // This is the button on the form
        var form = $("#form_tambah_cl_wisudawan")
        // The form button was pressed - open the dialog
        $(dialog).dialog({
            title: "Konvirmasi Penambahan Data",
            dialogClass: "no-close",
            width: 600,
            modal: true,
            buttons: {
                "Tambah": function () {
                     // This will invoke the form's action - putatively deleting the resources on the server
                     $(form).submit();
                     $(this).dialog("close");
                },
                "Cancel": function() {
                    // Don't invoke the action, just close the dialog
                    $(this).dialog("close");
                }
            }
        });
        return false;
    });
 });

my dialog box appear (like image 2) image 2

when i click button "tambah" in dialog box my value in form not passing. any mistake in my jquery code? any help?

  • 写回答

2条回答 默认 最新

  • duancan2539 2015-07-27 12:23
    关注

    replace $(form).submit(); with form.submit(); as you have already stored selector $("#form_tambah_cl_wisudawan") to var form.

    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类