Form_remote_tag


#1

I am using form_remote_tag as follows:
<%= form_remote_tag(:update => “sku”, :url=>{:action =>:generate_skus})
%>
The problem I am having is the web page will actually change to the
generate_skus page which defeats the purpose of using this. Any ideas on
why it wouldnt update the html code on the current page.


#2

Pat wrote:

I am using form_remote_tag as follows:
<%= form_remote_tag(:update => “sku”, :url=>{:action =>:generate_skus})
%>
The problem I am having is the web page will actually change to the
generate_skus page which defeats the purpose of using this. Any ideas on
why it wouldnt update the html code on the current page.

Post the code that responds to that action.


Phlip
http://www.oreilly.com/catalog/9780596510657/
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax


#3

Phlip wrote:

Pat wrote:

I am using form_remote_tag as follows:
<%= form_remote_tag(:update => “sku”, :url=>{:action =>:generate_skus})
%>
The problem I am having is the web page will actually change to the
generate_skus page which defeats the purpose of using this. Any ideas on
why it wouldnt update the html code on the current page.

Post the code that responds to that action.


Phlip
http://www.oreilly.com/catalog/9780596510657/
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax
controller
def generate_skus
@output = “This is not correct”
render :partial => “generate_skus”
end
view for _generate_skus
<%= @output %>


#4

Hi –

On Fri, 6 Jul 2007, Pat wrote:

I am using form_remote_tag as follows:
<%= form_remote_tag(:update => “sku”, :url=>{:action =>:generate_skus})
%>
The problem I am having is the web page will actually change to the
generate_skus page which defeats the purpose of using this. Any ideas on
why it wouldnt update the html code on the current page.

Are you sure you’re loading the necessary JavaScript files? It sounds
like maybe it’s falling back on doing a non-Ajax request to your
action.

David


#5

Pat wrote:

I am using form_remote_tag as follows:
<%= form_remote_tag(:update => “sku”, :url=>{:action =>:generate_skus})
%>

I can’t help because I just never use :update. I know it’s useful…

     def generate_skus
       @output = "This is not correct"
       render :partial => "generate_skus"
     end

view for _generate_skus
<%= @output %>

I’m also aware that some people don’t like to mix model and view code.
But I
would have written the response like this:

render :update do |page|
page.replace_html ‘sku’, @output
end


Phlip
http://www.oreilly.com/catalog/9780596510657/
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax


#6

unknown wrote:

Hi –

On Fri, 6 Jul 2007, Pat wrote:

I am using form_remote_tag as follows:
<%= form_remote_tag(:update => “sku”, :url=>{:action =>:generate_skus})
%>
The problem I am having is the web page will actually change to the
generate_skus page which defeats the purpose of using this. Any ideas on
why it wouldnt update the html code on the current page.

Are you sure you’re loading the necessary JavaScript files? It sounds
like maybe it’s falling back on doing a non-Ajax request to your
action.

David

I have used
<%= javascript_include_tag :defaults %>
which generates the following javascript


#7

I have the _generate_skus.rhtml in the views folder for the controller
that calls it and there is not a generate_skus.rhtml.


#8

If I understand what you’re saying - your generate_skus partial is being
rendered as a seperate page?

Is your generate_skus partial page named correctly? It’s been a little
while since I fooled with a partial, and I don’t have my environment
here
with me, but I think skus are named like “_generate_skus.rhtml” - do you
maybe have a file named “generate_skus.rhtml”?

Or do you have both _generate_skus.rhtml and generate_skus.rhtml in the
same
folder? Though I wouldn’t think that would be a problem.

Sorry if I’m mucking this up with the wrong syntax! :smiley:

On 7/5/07, Pat removed_email_address@domain.invalid wrote:

%>
David
which generates the following javascript


Posted via http://www.ruby-forum.com/.


Terry (TAD) Donaghe


http://www.rubynoob.com