Forum: Ruby on Rails select tag and fieldWithErrors

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
689107856b5a794181624031eb6df776?d=identicon&s=25 flukus@gmail.com (Guest)
on 2007-03-05 09:57
(Received via mailing list)
I've been trying to work out the rails way of handling this. I have my
form which contains:

<%= select(:user, :state_id, @states) %>

The only problem is that the fieldWithErrors div won't get added if
nothing is selected.

If I change it too:

<%= select(:user, :state, @states) %>

I get the error:

State expected, got String

Does rails have a graceful way of doing this?
502939bda3e3c0aa46e8aa2f1263baa0?d=identicon&s=25 Frank -- (foo-bar)
on 2007-09-18 23:37
hi!

please have a look at my blog post, as i described the problem and a
solution there:
http://blog.invalidobject.com/2007/09/16/rails-err...

regards,
 frank

flukus@gmail.com wrote:

> I've been trying to work out the rails way of handling this. I have my
> form which contains:
>
> <%= select(:user, :state_id, @states) %>
>
> The only problem is that the fieldWithErrors div won't get added if
> nothing is selected.
>
> If I change it too:
>
> <%= select(:user, :state, @states) %>
>
> I get the error:
>
> State expected, got String
>
> Does rails have a graceful way of doing this?
This topic is locked and can not be replied to.