zoukankan      html  css  js  c++  java
  • form_tag (ActionView::Helpers::FormTagHelper)

    form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block)
    Starts a form tag that points the action to an url configured with url_for_options just like ActionController::Base#url_for. The method for the form defaults to POST.
    
    Options
    :multipart - If set to true, the enctype is set to “multipart/form-data”.
    
    :method - The method to use when submitting the form, usually either “get” or “post”. If “put”, “delete”, or another verb is used, a hidden input with name _method is added to simulate the verb over post.
    
    A list of parameters to feed to the URL the form will be posted to.
    
    :remote - If set to true, will allow the Unobtrusive JavaScript drivers to control the submit behaviour. By default this behaviour is an ajax submit.
    
    Examples
     form_tag('/posts')
     # => <form action="/posts" method="post">
    
     form_tag('/posts/1', :method => :put)
     # => <form action="/posts/1" method="put">
    
     form_tag('/upload', :multipart => true)
     # => <form action="/upload" method="post" enctype="multipart/form-data">
    
     <%= form_tag('/posts') do -%>
       <div><%= submit_tag 'Save' %></div>
     <% end -%>
     # => <form action="/posts" method="post"><div><input type="submit" name="submit" value="Save" /></div></form>
    
    <%= form_tag('/posts', :remote => true) %>
     # => <form action="/posts" method="post" data-remote="true">
    [ show source ]
    
      # File actionpack/lib/action_view/helpers/form_tag_helper.rb, line 49
    def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block)
      html_options = html_options_for_form(url_for_options, options, *parameters_for_url)
      if block_given?
        form_tag_in_block(html_options, &block)
      else
        form_tag_html(html_options)
      end
    end
        <%= form_tag("#{Settings.cache_clear_link.host}&req_time=#{@time}&req_from=cms&sign=#{@sign}") do %>
          <%= submit_tag "[立即生效]" ,:class => "button" %>
        <% end %>
    
    
    
  • 相关阅读:
    我的那些年(11)~去一家创业公司做架构师
    springboot~hazelcast缓存中间件
    我的那些年(10)~来到更大的团队,做了架构师
    springboot~maven制作底层公用库
    Vesions ignore & ld: library not found for -l...
    iOS利用单例实现不同界面间的数据传输
    UVA 10006
    VS2010打开就自动关闭问题解决
    模板方法模式(Template Method)
    HDU 4279
  • 原文地址:https://www.cnblogs.com/iwangzheng/p/4042733.html
Copyright © 2011-2022 走看看