对于 form_tag 而不是 form_for,date_select 的等价物是什么? [英] What is the equivalent of date_select for a form_tag instead of form_for?

查看:46
本文介绍了对于 form_tag 而不是 form_for,date_select 的等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能在 form_for 中使用 f 变量,所以我需要一个用于 form_tag 的 date_select.你会如何把它用在 form_tag 上?

I can't use the f variable in a form_for so I need a date_select that is for a form_tag. How would you turn this to be used on a form_tag?

Form_for

<%= f.date_select :all_dates, :start_year => 2010, :end_year => 2012, :order => [:month, :day, :year], :use_short_month => true  %>

Form_tag

user_price = 型号

user_price = model

<%= date_select("user_price" , "all_dates", :start_year => 2010, :end_year => 2012, :order => [:month, :day, :year], :use_short_month => true  %>

推荐答案

如果我理解正确,你可以只使用 date_select 而没有 f,但是你能展示你的完整表单代码?

you can use just date_select without f if I understood you correctly, but can you show your full form code?

这篇关于对于 form_tag 而不是 form_for,date_select 的等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆