Submitting a form without clicking the submit button?

Hi Daniel,

Daniel Legrand wrote:

I'm using AJAX with 2 select pulldowns. When you select an item in the first pulldown, it dynamically populates the second pulldown. However, I need to value of the first select pulldown to know how to populate the second pulldown. When I select an element in the first pulldown, and submit via clicking the submit button, it posts the value as needed and sends in in the params hash. I'm trying to get the selected value to return via the params hash but to do so "onchange" instead of by clicking the submit button. Does anyone know how to submit a form without having the user click the button?

You don't submit the form. Use observe_field to submit the change to the first pulldown, then RJS to render the second. There's been quite a bit of discussion here about how to use observe_field with select boxes and I'm sure you can Google it up.

hth, Bill

Daniel Legrand wrote:

Thanks Bill. I just figured it out a few minutes ago. I wasn't sure if the method I chose was appropriate, but it looks like it is. Again, thanks for your help!

You're welcome!

Bill