0

前もって感謝します。

したがって、私の全体的な目標は、フォームがポップアップするモーダルダイアログボックスを取得することです。リンクをクリックしてモーダルを表示すると、JavaScriptを使用していないように見えるという問題が発生しています...JavaScriptが無効になっているようにページがレンダリングされるだけです。以下のコード:)

application.js

jQuery(function(){
$("#create_reminder_dialog").click(function() {
    $('#new_reminder_dialog').dialog('open');
});

// Initialzes Create Reminder Modal Box
$("#new_reminder_dialog").dialog({
    autoOpen: false,
    height: 350,
    width: 350,
    modal: true,
    buttons: {
        'Create New Reminder': function() {
            $('#new_reminder').submit();
        },
        Cancel: function() {
            $(this).dialog('close');
        }
    },
    close: function() {
            allFields.val('').removeClass('ui-state-error');
    }
});

});

Railsでの私のリンク

<%= link_to "Create reminder", new_reminder_path, :id=>'create_reminder_dialog' %>

リマインダー/new.html.erb

<% form_for :reminder, :url => {:action => "create"}, :html=>{:id=>"new_reminder_dialog"} do |form| %>
<%= form.text_field :description, :class=>"short" %>
<%= form.label :description %>
<%= form.text_field :days, :class=>"short" %>
<%= form.label "Days between interactions" %>
<%= submit_tag "Submit" %><%end>

ファイアバグでは、期待どおりのGETリクエストが表示されません。

トラブルシューティングのヒントは誰ですか?

4

1 に答える 1

2

falseリンクのhrefが起動しないようにするには、クリック機能に戻る必要があると思います。

$("#create_reminder_dialog").click(function() {
    $('#new_reminder_dialog').dialog('open');
    return false;
});
于 2010-07-22T03:00:19.530 に答える