简体   繁体   中英

form not displayed in page source

i am creating a veiw page in my rails application this is my view page :

<html>
    <head>
        <%= stylesheet_link_tag    "$.multiselect2side", :media => "all" %>
        <%= javascript_include_tag "$.multiselect2side" %>

        <script>
            $().ready(function() {
                $("#student_name_id").multiselect2side();
            });
        </script>
        <script>
            function callGrade(grade_value_123) {
                var id = grade_value_123;

            }
        </script>>

    </head>
    <body>
        <div class="container">

            <h1> <%= @message%> </h1>
            <%= select(:grade,:id,@distinct_grade_list,{},:onchange => "callGrade(this.value)")%>
            <%= select(:period,:id,@distinct_period_list)%>
            <%= select(:student_name,:id,@student_name_list,{},{ :multiple => true, :size => 4 }) %>
            <br/>

            <%= radio_button_tag(:age, :child,{},:onclick => "callMe(this.id)") %><%= label_tag(:age_child, :" General Curriculum") %>
            <%= radio_button_tag(:age, :adult) %><%= label_tag(:age_adult, :"Common Core Standards") %>

            <br/>
            <div id="farzi" style="border: 3px solid red;margin-top: 20px">
                <% form_tag('call_ajax', :method=>'post', :multipart => true) do %>
                <p>
                    Subject:
                    <br />
                    <%= text_field_tag "subject" %>
                </p>
                <p>
                    Priority:
                    <br />
                    <%= select_tag("priority", options_for_select([['Critical', '1'],
                    ['Important', '2'],['Standard','3']], '3')) %>
                </p>
                <p>
                    Describe your problem:
                    <br />
                    <%= text_area_tag "description", "", :size=>"50x20" %>
                </p>
                <p>
                    Add an attachment:
                    <br />
                    <%= file_field_tag "attachment" %>
                </p>
                <p>
                    <%= submit_tag 'Submit' %>
                </p>
                <% end %>
            </div>

    </body>
</html>

now when i execute the page , the page doent display any form ,

and when i check the page source , there is no form content inside the div with id= farzi

in the page source from browser it shows

 <div id="farzi" style="border: 3px solid red;margin-top: 20px">
            </div>

any explanation ??

Replace

<% form_tag('call_ajax', :method=>'post', :multipart => true) do %>

with this

<%= form_tag('call_ajax', :method=>'post', :multipart => true) do %>

The <%= is used to output data from ruby in html.erb. If you just execute first command, it will return the correct data, but it won't output anything in html.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM