0

フォームの保存ボタンが 2 回クリックされないようにしようとしています。フォームのタグに設定onsubmit='save.disabled=true'すると、送信時にボタンが無効になりますが、POST データには「保存」キーと値が含まれなくなりました。フォームには複数のボタンがあるため、どのボタンがクリックされたかを知る必要があります。この副作用なしで保存ボタンを無効にする別の方法はありますか?

<form method='post' action='dosomething.php?' enctype='multipart/form-data' onsubmit='save.disabled=true'>
    ... input types & Other buttons ...
    <input type='submit' name='save' value='Save'>
</form>
4

2 に答える 2

0

Can you assign another variable the value of the button you clicked before disabling? Something along the lines of:

$('#submit').click(function () {
    $('#form').append("<input type='hidden' name='" + $(this).attr('name') + "' value='"+
                     $(this).attr('value')+ "' />");
    $(this).attr("disabled", true);
    $('#form').submit();
    });
于 2013-10-09T05:54:52.223 に答える