I'm new to rjs and ajax...doing the example in RJS Templates for rails.
I'd like to submit the form onChange...but my onChange code doesn't work as expected. I get the js code in the browser window..instead of my updated page.
It does still work when I press the submit button though.
My form code:
<%= form_remote_tag :url => {:action => 'log'}, :html => { :id => 'thought-form'} %> <%= text_field_tag 'thought', nil, {:size => 40, :onChange => 'this.form.submit()'} %> <%= submit_to_remote 'Log thought', 'Check' %> </form>
This is what I see in the browser.
try { new Insertion.Top("thoughts", "<p>\n\ta random thought\n</p>"); new Effect.Highlight("thoughts",{}); Form.reset("thought-form"); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('new Insertion.Top(\"thoughts\", \"<p>\\n\\tchris.ca EXIST\\n</p>\");\nnew Effect.Highlight(\"thoughts\",{});\nForm.reset(\"thought-form\");'); throw e }
Any Ideas?