Difficulty with params hash and submit_to_remote

Hi,

Is there any trick to initializing the params hash via
submit_to_remote()? I
have a form with two submit methods - the regular, non-AJAX method, and
the
AJAX method. The regular method works like a champ. The
submit_to_remote
invokes the correct controller, but the params hash is empty except for
the
values for :action and :controller.

I’d show my code, but it’s on an internal network and I can’t
cut-and-paste.

Thanks,

-stan

Nothing magic here, just add the other parameters to the remote_function
or link_to_remote calls like this…

<%= link_to_remote “Link”, :update=>‘updatediv’,
:controller=>‘controller’, :action=>'action", :id=>object.id, :other
=>‘other stuff’ %>

Things like other should now be in the params array for the recieving
action

_Kevin

Kevin O. wrote:

Nothing magic here, just add the other parameters to the remote_function
or link_to_remote calls like this…

ok, I’m confused (but I am a newbie!). I thought the whole idea with
submit_to_remote() was to make the contents of a form available to the
controller in the params hash, just as if I had submitted it via
non-AJAX form. Otherwise, I could have just called link_to_remote()
instead.

Any suggestions?

Kevin,

Thanks. Believe it or not, it was a missing tag in the view that
was preventing the form values from being passed.

-stan

Kevin O. wrote:

It would help if I actually read your question right.

Take a close look at the API for submit_to_remote… if you also read
the docs for form_remote_tag. This indicates that there is a way to set
it up to fallback to a normal submit if JS is disabled. You shouldn’t
need wo submit mechanisms.

I haven’t actually used this yet, so I can’t help much more than that.

_Kevin

It would help if I actually read your question right.

Take a close look at the API for submit_to_remote… if you also read
the docs for form_remote_tag. This indicates that there is a way to set
it up to fallback to a normal submit if JS is disabled. You shouldn’t
need wo submit mechanisms.

I haven’t actually used this yet, so I can’t help much more than that.

_Kevin

Hi guys,

i’ve got the same problem. But in my situation I have to send values of
text-inputs via submit_to_remote() to my controller. I don’t know how to
get the value of this text-input:
<%= text_field_with_auto_complete(:vorgang, :bez, {:value => ‘****’},
{:skip_style => true} ) %>

to my controller:

def filterDatensatz()
tmp = params[:vorgang][:bez]
my_redirect_to(:action => ‘list’, :tmp => tmp)
end

params[:vorgang] is always nil.

Can you help me?

Greetings
Chris

try something like this:

rhtml:
<%= text_field_with_auto_complete :person, :nachname, {},
{
:select => ‘name’,
:after_update_element =>
“function(element,value) " +
“{ " +
remote_function(:update=>‘Kundendaten’,
:url=>{:action=>:update_kundendaten},
:with=>”‘adr_id=’+value.id”) + “;” +
“}”
}
%>

controller:
def update_kundendaten
#params[:adr_id] should be ok in controller
end

but with this solution i have the problem that the autocomplete is only
working on IE.
FF wont show the autocomplete popup. :frowning:

HTH

On 12 Jan., 11:42, Christian R. [email protected]