Observe_form not serializing form

I want to use observe_form to automatically save notes in a text_area.
This is the code I have:

<%= text_area :contact, :notes, :cols => 40, :rows => 10, :id =>'notes_text_area' %> <%= observe_form('notes_form', :frequency => 1, :url => {:action => 'update_notes', :contact_id => @contact.contact_id}) %>

For some reason, the contents of the text area are not being sent in the
post. In fact it doesn’t appear that the form is being serialized at
all. What am I doing wrong?

On 8/15/06, Adam T. [email protected] wrote:

                          :contact_id => @contact.contact_id}) %>
        </form>

For some reason, the contents of the text area are not being sent in the
post. In fact it doesn’t appear that the form is being serialized at
all. What am I doing wrong?

Hi,

I’ve been struggling with the same problem for a few days now. The api
docs that describe the “:with” parameter to observe_field/form are
cryptic, to say the least.

After trying a number of semi-random strings I just now hit on a
solution that seems to work: passing the string “value=value” as the
:with param causes all of your form variables to show up in the POST
params. I pass this on with the caveat that I haven’t the faintest
idea why this works, and with no warranties that it won’t break in the
future.

hth,
James


James H.
Web application developer
Vancouver, BC

“Developing a coherent political analysis is in many respects
contingent upon an ability to connect one context to another, a
process not dissimilar to playing the kid’s game of dot-to-dot.”

  • Ward Churchill, from ‘“A Government of Laws”?’

On 8/15/06, Adam T. [email protected] wrote:

Form.serialize(‘notes_form’)})})
//]]>

Yes, it’s definitely not working as advertised. One thing I’ve been
trying to get working is having the response to the form observer
inject new input elements into the form, and then have those new
elements be ‘observed’ as well: no joy, though, it will only fire on
events on form elements that were there when the form was first
rendered.

Thanks for pointing out the serialize method above; I thought it might
help with this issue but no. I’ve hardcoded this snippet into my app
as well.

Has this been reported as a bug on the rails trac?

jh

idea why this works, and with no warranties that it won’t break in the
"Developing a coherent political analysis is in many respects
http://lists.rubyonrails.org/mailman/listinfo/rails


James H.
Web application developer
Vancouver, BC

“Developing a coherent political analysis is in many respects
contingent upon an ability to connect one context to another, a
process not dissimilar to playing the kid’s game of dot-to-dot.”

  • Ward Churchill, from ‘“A Government of Laws”?’

James, it has to be a bug. I just hard coded the javascript using the
prototype library as the observe_form function SHOULD do, and it works
fine:

        //<![CDATA[
          new Form.Observer('notes_form', 1, function(element, 

value)
{new
Ajax.Request(‘/contacts/update_notes?contact_id=155’,
{asynchronous:true, evalScripts:true, parameters:
Form.serialize(‘notes_form’)})})
//]]>

-Adam

James H. wrote:

On 8/15/06, Adam T. [email protected] wrote:

                          :contact_id => @contact.contact_id}) %>
        </form>

For some reason, the contents of the text area are not being sent in the
post. In fact it doesn’t appear that the form is being serialized at
all. What am I doing wrong?

Hi,

I’ve been struggling with the same problem for a few days now. The api
docs that describe the “:with” parameter to observe_field/form are
cryptic, to say the least.

After trying a number of semi-random strings I just now hit on a
solution that seems to work: passing the string “value=value” as the
:with param causes all of your form variables to show up in the POST
params. I pass this on with the caveat that I haven’t the faintest
idea why this works, and with no warranties that it won’t break in the
future.

hth,
James


James H.
Web application developer
Vancouver, BC

“Developing a coherent political analysis is in many respects
contingent upon an ability to connect one context to another, a
process not dissimilar to playing the kid’s game of dot-to-dot.”

  • Ward Churchill, from ‘“A Government of Laws”?’

I tried reporting it as a bug today, but the bugtracking system was
unreachable…

-Adam

James H. wrote:

On 8/15/06, Adam T. [email protected] wrote:

Form.serialize(‘notes_form’)})})
//]]>

Yes, it’s definitely not working as advertised. One thing I’ve been
trying to get working is having the response to the form observer
inject new input elements into the form, and then have those new
elements be ‘observed’ as well: no joy, though, it will only fire on
events on form elements that were there when the form was first
rendered.

Thanks for pointing out the serialize method above; I thought it might
help with this issue but no. I’ve hardcoded this snippet into my app
as well.

Has this been reported as a bug on the rails trac?

jh

idea why this works, and with no warranties that it won’t break in the
"Developing a coherent political analysis is in many respects
http://lists.rubyonrails.org/mailman/listinfo/rails


James H.
Web application developer
Vancouver, BC

“Developing a coherent political analysis is in many respects
contingent upon an ability to connect one context to another, a
process not dissimilar to playing the kid’s game of dot-to-dot.”

  • Ward Churchill, from ‘“A Government of Laws”?’