Steve,

When you reload/refresh the page, the browser remembers some of the
current state of the page, so that a browser refresh is not the same
as loading the page again - ie by resubmitting the url (which best
simulates the effect you see after a validation error).  It is easy to
get fooled with this especially if you have js functions on the page.

In order to make sure the correct form/partial is redisplayed, you
will need to make sure that information about which partial is
currently displayed is available to the server in some way.  In your
case, that is going to be the value of the select control returned in
the params hash which will need to control the creation of the page by
setting the right partial to be displayed.

Because you are showing/hiding the partials, then a way to do this is
to not use a js function to set them to not display, but to do it
using css styles which you can set up when the page is displayed.   A
little bit of logic in the page redisplay can then determine which
partial should be displayed based on the params value of your select
box.

My personal preference to meet your needs would be to use the solution
suggested by Bill, to use an observer on the select which would cause
the required partial to be displayed.  Using this approach keeps the
server in control of what is being displayed.

Tonypm

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to