Cómo hacer cumplir seleccionar un valor en la opción de selección usando simple_form en Rails 3
Frecuentes
Visto 105 veces
0
How could I enforce user to choose a service_type,
because when the page loaded, the select option shows "choose one?" by default
-service_type=[a,b,c]
= f.input :service_type, label: "service", collection: @service_type, prompt: "choose one?"
gracias ~
1 Respuestas
0
by setting the model attribute to the value you want to enforce before rendering the input:
- f.object.service_type = your_default_service_type
= f.input :service_type, label: "service"....
I'd recommend you to do it on the model or the controller other than in the view.
Respondido el 22 de Septiembre de 13 a las 07:09
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas ruby-on-rails ruby-on-rails-3 simple-form or haz tu propia pregunta.