Text field not being submitted via form_remote_tag; works vi

Hi everyone,

Newbie here. I’m trying to get a textual form element to submit in
the context of a form_remote_tag block and having little success.
Oddly (or perhaps not), using regular old form_tag in its place does
cause the elements to be submitted. Here’s the relevant partial ERb
code:

<%= form_remote_tag( { :url => { :action => :out, :id => pending_task }
} ) %>

<%= pending_task.project.client.name %> <%= pending_task.project.name %> <%= pending_task.started_at %> <%= '' % pending_task.id %><%= distance_of_time_in_words(pending_task.started_at, Time.now) %> <%= submit_tag "Clock out" %> <%= '' % pending_task.id %> Enter task description: <%= text_area "pending_task", "description" %> <%= end_form_tag %>

Initially, the row containing the textarea is hidden. When the user
hits the submit button, the controller checks to see whether the
textarea has been properly filled out. If so, it records the
parameter; if not, it unhides the row and returns.

Can someone tell me why the controller never sees
pending_task[description]? Again, it does work properly if I use a
standard form, but not its AJAXified cousin.

Here’s the log data:

Processing ClockController#out (for 127.0.0.1 at 2006-07-31 16:20:38)
[POST]
Session ID: …
Parameters: {“action”=>“out”, “id”=>“9”, “controller”=>“clock”}

Regards,

–Michael

Michael S. Fischer wrote:

Hi everyone,

Newbie here. I’m trying to get a textual form element to submit in
the context of a form_remote_tag block and having little success.
Oddly (or perhaps not), using regular old form_tag in its place does
cause the elements to be submitted. Here’s the relevant partial ERb
code:

<%= form_remote_tag( { :url => { :action => :out, :id => pending_task }
} ) %>

Michael,
Another newbie here offering a suggestion. Have you tried
“text_area_tag” instead of “text_area”? Text area’s documentation left
me a bit confused. “text_area_tag”, on the other hand is simple and
worked well for me in a similar situation.

jp

Michael S. Fischer wrote:

<%= form_remote_tag( { :url => { :action => :out, :id => pending_task }
} ) %>

Forms must either span a whole table or be wholly inside a table cell.
If you can’t put your form around the whole table because you need a
separate one for each pair of rows, look at using the :submit option
of submit_to_remote.


We develop, watch us RoR, in numbers too big to ignore.

On 8/2/06, Mark Reginald J. [email protected] wrote:

Michael S. Fischer wrote:

<%= form_remote_tag( { :url => { :action => :out, :id => pending_task }
} ) %>

Forms must either span a whole table or be wholly inside a table cell.
If you can’t put your form around the whole table because you need a
separate one for each pair of rows, look at using the :submit option
of submit_to_remote.

Do you mean the :with option? I don’t see a :submit option in the API
documentation. Alternatively, do you mean the :submit option of
link_to_remote?

–Michael

Michael S. Fischer wrote:

On 8/2/06, Mark Reginald J.
[email protected] wrote:

Forms must either span a whole table or be wholly inside a table cell.
If you can’t put your form around the whole table because you need a
separate one for each pair of rows, look at using the :submit option
of submit_to_remote.

Do you mean the :with option? I don’t see a :submit option in the API
documentation. Alternatively, do you mean the :submit option of
link_to_remote?

submit_to_remote has a :submit option, though it is only implied in
the API docs by stating that submit_to_remote has the same options as
form_remote_tag, which in turn uses the same options as link_to_remote.

But yes,

:submit => row_id

is equivalent to

:with => “Form.serialize(’#{row_id}’)”


We develop, watch us RoR, in numbers too big to ignore.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs