Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4746 (closed defect: duplicate)

Opened 3 years ago

Last modified 2 years ago

submit_to_remote should be submit type, not button type?

Reported by: James Le Cuirot <chewi@aura-online.co.uk> Assigned to: David
Priority: normal Milestone:
Component: ActionPack Version: 1.0.0
Severity: normal Keywords:
Cc:

Description

I'm not 100% sure about this but my tests seem to work. The submit_to_remote function generates an input tag of type "button" and uses onclick to submit the form. When JavaScript is disabled, however, nothing happens because "button" tags do not trigger the submission of the form. Only "submit" tags do that. I changed the type generated by submit_to_remote to "submit" and it still seems to work with JavaScript enabled as well as having the added benefit of also working when JavaScript is disabled, so why not just use "submit" instead?

Change History

(in reply to: ↑ description ) 11/06/06 23:36:46 changed by timocracy

Agreed. As it stands you need to attach an onclick to a submit_tag with an explicit remote_function call (and a cancel, to prevent the form from non-Ajax submitting, as well, of course) to get an Ajax submission that will degrade to a normal one, which seems like a pretty standard usage you might want out of this.

01/24/07 03:03:30 changed by jeremymcanally

  • status changed from new to closed.
  • resolution set to duplicate.

See my patch at #7256 to fix this.