If there is a form between table and th and td, the confirm dialog will not appear.

Asked 2 years ago, Updated 2 years ago, 49 views

I am developing it at Ruby on Rails.

 button_to 'delete', xxxx_path(xxx.id), method: :delete,confirm: 'Do you really want to delete it?'

#=><input class="Button" data-confirm="Are you sure you want to delete it?" name="commit" type="submit" value="delete"/>

We created a delete button like ↑, and although the delete itself succeeded, the confirm dialog may or may not succeed.

I was wondering why, and while I was looking into it, I found an article like this.
http://qiita.com/yuji0222/items/80fd7a25486f8bb85752

If there is a form between table and th and td, it seems that the confirm dialog does not appear.

I found out about this, but I couldn't find a plan to deal with it, so I have given up sending a confirm dialog.

If there is a way to display the confirm dialog in the table, I would like your advice.

Thank you for your cooperation.

ruby-on-rails ruby html html5

2022-09-30 15:38

2 Answers

You must enclose the entire FORM or include FORM in the TD, TH.If you can't do that, you need to review the HTML structure.


2022-09-30 15:38

Some HTML elements are limited to the elements that are placed directly below the child element.
I can't do this, but

<table>
    <form>
        <tr>
            <th>/th>
            <td></td>
        </tr>
    </form>
</table>

This is OK

<form>
    <table>
        <tr>
            <th>/th>
            <td></td>
        </tr>
    </table>
</form>


2022-09-30 15:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.