Hi Joel,
There's a dozen topics on render .. something, none of which talks about the issue I'm having. Anyone else want to explain how I can accomplish this that can provide more than 7 words?
Many thanks in advance.
There's a dozen topics on render .. something, none of which talks about the issue I'm having. Anyone else want to explain how I can accomplish this that can provide more than 7 words?
Instead of loading the form via an ajax request, make it part of the initial page. When the page loads, executes some javascript that hides the search form. If javascript is disabled then that code doesn't run and so the form isn't visible, if it is enabled then it will be hidden.
Fred
Fred, thanks for the help. I was able to do:
<%= check_box "search", "info" %> <%= observe_field(:search_info, :on=>'click', :frequency=>0.25, :update => :form_container, :with => :search_info, :url => { :action => :search_form }) %> <% controller.response.content_type = Mime::HTML%> <div id="hide_container"><%= render :partial => 'search' %></div> <div id="form_container"></div> <%= javascript_tag render( :partial => 'hide_div.js.rjs') %>
And then in the rjs partial I placed:
page.hide :hide_container
This allowed the search partial to be displayed in the div id for hide_container which is viewable by those without ajax/scripting enabled. And the render for rjs hides that partial and the checkbox/observer still allows the form to be viewed click/unclick.
It looks fairly clean.