3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

confirmが発生しない条件がある

Last updated at Posted at 2013-08-02

疑問

なぜtableタグで囲むとconfirmが発生しないのかわからなくて困ってます
情報等ありましたらコメントお願いします

confirmが発生しないコード

view_hoge.rb

<table >
	<tr>
	<%= form_tag({:action => :import}, {:multipart => true}) do %>
		<th>入力</th>
		<td>
			<%= file_field_tag :file %>
			<%= submit_tag 'csv', :data => { :confirm => '入力') } %>
		</td>
	<% end %>
	</tr>
</table>

hoge.html

<table >
	<tr>
	<form accept-charset="UTF-8" action="/hoge/import" enctype="multipart/form-data" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="/=" /></div>
		<th>入力</th>
		<td>
			<input id="file" name="file" type="file" />
			<input class="Button" data-confirm="実行しますか?" data-disable-with="処理中..." name="commit" type="submit" value="登録" />
		</td>
	</form>	
	</tr>
</table>

confirmが発生する

view_hoge.rb

<%= form_tag({:action => :import}, {:multipart => true}) do %>
	入力
	<%= file_field_tag :file %>
	<%= submit_tag 'csv', :data => { :confirm => '入力' } %>
<% end %>

hoge.html

<form accept-charset="UTF-8" action="/hoge/import" enctype="multipart/form-data" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="=" /></div>
		<input id="file" name="file" type="file" />
		<input class="Button" data-confirm="実行しますか?" data-disable-with="処理中..." name="commit" type="submit" value="登録" />
</form>
3
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?