This project is archived and is in readonly mode.

#388 ✓resolved
scott stewart

submit_tag emits extra semicolon when no onclick options are provided

Reported by scott stewart | June 11th, 2008 @ 01:33 PM

The submit_tag in form_tag_helper allows for an 'onclick' option to be bassed as one of the options hash items. Currently, if there is no 'onclick' item in the options hash then the submit_tag includes an extra semicolon in the generated onclick string.

This is caused by the .join(';') on the array of options when one of the options ('onclick') in this case, is nil.

This patch removes nil items from the options array before calling .join(';').

So, if you use this in your view:

submit_tag("Save", :disable_with => "Saving...")

Before the patch, the output looks like this:

After the patch, the output looks like this:

Notice the extra semicolon in the before patch output around this area:

this.disabled=true;this.value='Saving...;';*;*result =

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages