Form posts twice - once as post and again as get. Help! (2nd try)

Hi all,

I am posting this again since there was no response the first time.

I am having a very strange problem. I have a search form with a bunch of fields for a db query of a table called people. The associated :person model has_many sub models such as :addresses, :skills etc. The Person.find uses :include to eager load the data from various other tables which :belong_to people.

The results page contains a form built dynamically where the user can select check boxes to the select persons from the result set and then save the set.

The problem: The search form is submitted and the query processed and the results page rendered. tail -f log shows..

First post: Processing PersonSearchController#search (for 127.0.0.1 at 2007-02-20 13:49:28) [POST] Parameters: {"person_search"=>{"city"=>"", "skill_id_3"=>"", "skill_search"=>"1",...etc, etc

.....normal processing happens here till.... Rendered person_search/_results (0.00915) Rendered layouts/_footer (0.00027) Completed in 15.63002 (0 reqs/sec) | Rendering: 0.25152 (1%) | DB: 0.02095 (0%) | 200 OK [http://localhost/person_search/search\]

The strange thing is that my breakpoint in the search action hits again immediately. And I get a second post which actually is a get.

Processing PersonSearchController#search (for 127.0.0.1 at 2007-02-20 13:49:44) [GET] Session ID: 30519ded2f3bfa275e4cb7a2c1e67edc Parameters: {"action"=>"search", "controller"=>"person_search"}

There are no form params this time. This causes (500 Internal Error)

Relevant info:

Both the search form and the results page with the form have auto_complete fields which work fine and actually use a dedicated auto_completion_controller.

Has any one seen this behaviour? Any clues/pointers will be greatly appreciated.

-bakki

PS: Since my first post I made the following changes. I was using a form builder helper form_for though it was a non-model form. It has worked for me in the past. I changed the form to a non-model form with start_form_tag and field_tags. Didn't help.

PS: Since my first post I made the following changes. I was using a form builder helper form_for though it was a non-model form. It has worked for me in the past. I changed the form to a non-model form with start_form_tag and field_tags. Didn't help.

Bakki - grab yourself firebug[1] and watch the 2 form submits happen. Using this plugin you can debug the client side - breakpoints etc.

my gut tells me you're using a button onclick event to submit the form - which is likely triggering a GET - then the onsubmit JS is running a POST

Jodi

[1] https://addons.mozilla.org/firefox/1843/