I''ve been playing with the new RJS stuff in RoR1.1, and I have to say
that I''m am extremely impressed, NICE! work guys. However, I seem to
be
having a bit of a problem. I promise, I''ve googled the hell out of it
and haven''t found an answer.
Set up: Putting together a little proof of concept app. Display a form
(index.rhtml) that just has a button to call the next action
(show_admin_conf). Have created a show_admin_conf.rjs and the
show_admin_conf method is actually empty. When it goes to the
show_admin_conf.rjs I''m just asking it to hide a <LI> tag with a
given
id. What I get is the <LI> tag updated AND the result of the RJS in the
content area where I''m trying to update (not related to <LI> tag)
Should
be pulling up a new partial in show_admin_conf.rhtml.
the controller code
class AbeProto1Controller < ApplicationController
def index
end
def show_conf_admin
end
def conf_admin
render( :partial => "conf_net")
end
end
*******************************************************************************
The index.rhtml:
<%=
javascript_tag("document.getElementById(''index'').className=''selected'';")
%>
<div id="main_title">
<%= $PROJECT_NAME %> Configuration Wizard
</div> <!-- main_title -->
<div id="main_description">
This wizard will walk you through configuring your <%=
$PROJECT_NAME %>
system. Click the Begin button to start the process.
</div> <!-- main_description -->
<%= form_remote_tag(:url => { :action => "show_conf_admin" },
:update =>
"main") %>
<div id="main_content">
-no content-
</div> <!-- main_content -->
<div id="main_options">
Press Begin to start.
<div id="main_buttons">
<%= submit_tag("Begin!") %>
</div> <!-- main_buttons -->
</div> <!-- main_options -->
<%= end_form_tag %>
********************************************************************************
the show_admin_conf.rjs (in same directory as my rhtml files)
page[''index''].hide
puts "ONE"
render(:partial => ''conf_admin'', :update =>
''main'')
puts "TWO"
********************************************************************************
And, finally, the _conf_admin.rhtml partial:
<%=
javascript_tag("document.getElementById(''conf_admin'').className=''selected'';")
%>
<div id="main_title">
<%= $PROJECT_NAME %>: Configure Administrator
</div> <!-- main_title -->
<div id="main_description">
Complete the following form to configure your administrative
user. This user
will have access to all portions of the system. Please choose a
strong
password and provide an email address that is monitored by an
administrator.
</div> <!-- main_description -->
<%= form_remote_tag(:url => { :action => "conf_admin" },
:update => "main") %>
<div id="main_content">
-no content-
</div> <!-- main_content -->
<div id="main_options">
Press Next to continue.
<div id="main_buttons">
<%= submit_tag("Next") %>
</div> <!-- main_buttons -->
</div> <!-- main_options -->
<%= end_form_tag %>
********************************************************************************
The div id "main" defined in my template (not really interesting, so
not
included) is where the index.rhtml and _conf_admin.rhtml are supposed to
render.
Ok, now, here''s what I''m getting, and ALL I''m getting
in my "main" div:
$("index").hide();
Which is correct. . .sort of. It DOES hide the index object correctly,
but displays the above in the div and does not show my partical in the
"main" div.
Been working on this for about 24 hours, most of that spent googling and
reading over everybody''s examples (again, and again, and again : b).
Any help would be GREATLY appreciated. I know something silly is going
on here, but for the life of me I can''t figure out what.
Thanks!
Gerald
--
Posted via http://www.ruby-forum.com/.