0

フォームにラジオ選択フィールドがあります。

  <div class="field">
   <%= f.label :sicherheit, "Verdacht auf" %>
   <%= f.radio_button :sicherheit, 'V' %>
   <%= f.label :sicherheit, "Zustand nach" %>
   <%= f.radio_button :sicherheit, 'Z' %>
   <%= f.label :sicherheit, "Ausschluss" %>
   <%= f.radio_button :sicherheit, "A" %>
   <%= f.label :sicherheit, "Gesicherte Diagnose" %>
   <%= f.radio_button :sicherheit, "G" %>
  </div>

ユーザーが 1 つのオプションを選択すると、icd コントローラーで検証アクションが呼び出されるようにしたいと思います。もっとよく想像するには、次のようなリンクが必要です。

 <%= link_to "#{g.nummer}", icd_validate_path(g), remote: true %>

私が欲しいものを理解してくれることを願っていますか?ありがとう!

4

1 に答える 1

0

Jqueryを使用したAJAX呼び出しが必要だと思いますが、route.rbでicd_validate_path(g)正しく定義されており、コントローラーがjs形式に応答することを確認してください。

<script type="text/javascript">
$(function(){
    $('input[type="radio"]').click(function(){
        $.ajax({url: '<%= icd_validate_path(g) %>', data: {'value': $(this).val()}, success: function(data){
           alert('success'); 
           //do some your actions.
        }})
    });
});
</script>
于 2013-08-20T08:16:30.783 に答える