0

フォームがあります。このフォーム内では、ボタンのクリックで表示されるモーダル ダイアログを使用しています。ダイアログには、同じフォームのいくつかの入力フィールドを含む div が含まれています。その内容はサーバーに送信されることはありません(メソッドPOST)ので、少しデバッグを開始しました...

  1. ダイアログを開かない場合、フィールドは使用可能です (サーバー側)
  2. ダイアログを開いてフィールドに値を入力すると、フィールドが送信されなくなりました (使用できません)。
  3. div を非表示 (表示: なし) にしないと (フォームが読み込まれるとフィールドが表示されます)、モーダル ダイアログを使用せずに入力すると、そこに送信されます。

-> ダイアログがフォームからフィールドを「削除」するのはなぜですか?

ご意見ありがとうございます。ウルス

HTML

<button type="button" id="opener">other, please click here</button>

<div id="dialog-modal" title="type in the new elements:" style="display: none">
<p>country:<input type="text" class="small" id="othercountry" name="othercountry" value=""  </p>
<p>ccode:<input type="text" class="small" id="othercountryCode" name="othercountryCode" value=""></p></div>

Javascript

<script>
$( "#opener" ).click(function() {
    $( "#dialog-modal" ).dialog({
       height: 140,
       modal: true
    });
    $( "#dialog-modal" ).bind('dialogclose', function(event) 
      { do some other things, not relevant for the form }
    );
});
</script>      

jQuery1.8.2

4

3 に答える 3

1

デフォルトでは、jQuery はダイアログを本文に追加するため、フォーム内に戻す必要がある場合があります。これは次のように行うことができます。

$('#dialog-modal').parent().appendTo($('form:first'))

バグチケットこちら

于 2012-11-30T10:21:01.060 に答える
0

フォームタグは表示されません。フォームタグはモーダルdiv内にあるはずです。

<div id="dialog-modal" title="type in the new elements:" style="display: none">
    <form>
        <p>country:<input type="text" class="small" id="othercountry" name="othercountry" value=""  </p>
        <p>ccode:<input type="text" class="small" id="othercountryCode" name="othercountryCode" value=""></p>
    </form>
</div>
于 2012-11-30T08:57:35.090 に答える