Tag: Rails3/問い合わせフォーム

目次

関連ページ

参考情報

基本

概要

モデルの生成

ActionMailerの設定

smtpサーバーの設定

Mailerの設定

お問い合わせフォームのビュー

    <%= form_for(@contact, :url => about_create_path, :html => {:class =>'form-inline'}) do |f| %>
        <% if @contact.errors.any? %>
            <div id="error_explanation">
                <h2>エラーが発生しました :</h2>
                <ul>
                    <% @contact.errors.full_messages.each do |msg| %>
                        <li><%= msg %></li>
                    <% end %>
                </ul>
            </div>
        <% end %>
        <table class="table table-bordered table-condensed">
            <tr>
                <th class="span2">お名前</th>
                <td><%= f.text_field :name, {:class => 'span6'} %></td>
            </tr>
            <tr>
                <th class="span2">メール</th>
                <td><%= f.text_field :email, {:class => 'span6'} %></td>
            </tr>
            <tr>
                <th class="span2">題名</th>
                <td><%= f.text_field :subject, {:class => 'span6'} %></td>
            </tr>
            <tr>
                <th class="span2">内容</th>
                <td>
                    <%= f.text_area :message, {:rows => 6, :class => 'span6'} %>
                </td>
            </tr>
        </table>
        <p>
        <span style="width:200px;">
            <%= f.submit '送信',  :name => 'save_button', :class=>'btn btn-primary' %>
        </span>
        </p>
    <% end %>

お問い合わせフォームのコントローラー

ルーティングの設定

Tips

メールアドレスを併記する


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-04-11 (月) 15:28:17