I decided to create an advanced search form which is stored in a partial
called:
_search.html.erb
Right now the partial just contains a simple two box nested form_tag..
In my index.html I have the following:
<% form_tag controller.controller_path, :method => ''get''
do %>
  Advanced Search
  <%= check_box "search", "info" %>
  <%= observe_field(:search_info,
    :on=>''click'',
    :frequency=>0.25,
    :update => :submit_div,
    :with => :search_info,
    :url => { :action => :search_form }) %>
  <div id="submit_div">
  </div>
<% end -%>
Which basically monitors the search_info from the check_box and when it
hits an event onClick it goes to the search_form method specified in my
controller, updating :search_info..
So, in my controller I tested all of the returns:
def search_form
  validate_date_form
  if params[:search_info] == "null"
    #render :text => ""
    render :text => "Debug search_info unchecked = " +
params[:search_info]
  else
    #render :partial => "search"
    render :text => "Debug search_info checked = " +
params[:search_info]
  end
end
When I fire up my page, if I click the checkbox I receive:
Debug search_info checked = "1"
If I uncheck the checkbox I receive:
Debug search_info unchecked = "null"
If I comment out the debug lines and uncomment what''s listed above the
following occurs:
Firefox:
If I check the box the partial is rendered.  If I uncheck the box, the
partial is removed.
Internet Explorer:
If I check the box, nothing happens.  If I uncheck the box, I can see a
slight buffer from the empty div showing so the "null" is accepted.
Why is the partial not rendering in I.E.?
-- 
Posted via http://www.ruby-forum.com/.
On Jul 6, 4:56 pm, "Älphä Blüë" <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> If I comment out the debug lines and uncomment what''s listed above the > following occurs: > > Firefox: > > If I check the box the partial is rendered. If I uncheck the box, the > partial is removed. > > Internet Explorer: > > If I check the box, nothing happens. If I uncheck the box, I can see a > slight buffer from the empty div showing so the "null" is accepted. > > Why is the partial not rendering in I.E.?Looks like your html will be invalid (so browsers can do what they want), as when your partial is rendered you''ll end up with a form nested inside a form (at least that''s my reading of your code) Fred> -- > Posted viahttp://www.ruby-forum.com/.
Update: Firefox 3.5 => partial renders OK Opera 9.6.4 => partial renders OK Safari 4.0 => partial renders OK Internet Explorer 8 => partial does not render -- Posted via http://www.ruby-forum.com/.
Frederick Cheung wrote:> On Jul 6, 4:56�pm, "�lph� Bl��" <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> If I check the box, nothing happens. �If I uncheck the box, I can see a >> slight buffer from the empty div showing so the "null" is accepted. >> >> Why is the partial not rendering in I.E.? > > Looks like your html will be invalid (so browsers can do what they > want), as when your partial is rendered you''ll end up with a form > nested inside a form (at least that''s my reading of your code) > > FredSorry Fred, Didn''t see your message before I last posted.. What do you suggest I do regarding what I''m trying to accomplish? I just want a checkbox that when checked displays my search form and when unchecked displays an empty rendered text. Should I place the rendered form in another area that makes it unnested? -- Posted via http://www.ruby-forum.com/.
Sorry Fred,
I''m dense this morning - I figured it out:
      <td align="left" valign="middle">
        Advanced Search
        <%= check_box "search", "info" %>
        <%= observe_field(:search_info,
          :on=>''click'',
          :frequency=>0.25,
          :update => :submit_div,
          :with => :search_info,
          :url => { :action => :search_form }) %>
        <div id="submit_div">
        </div>
      </td>
I forgot that I was going with an older model where I''d verify a
submit.
I didn''t need the first form at all.  I forgot to remove that..
Thanks!
-- 
Posted via http://www.ruby-forum.com/.