Hi all, I just upgraded to Rails 1.1.0 and noticed a strange error. I created a test application with one model that has two data fields. I generated the scaffold for the model and controller, and created some test data. When I click on the scaffold-generated "Destroy" link, extra whitespace underneath the "Destroy" link flashes on the screen until the destroy action reloads the list of data. Totally weird. It''s more of an annoyance because the display actually changes for a split-second, but I want to know if anyone has seen this problem. How can I prevent the whitespace from appearing while destorying a record? Brandon -- Posted via http://www.ruby-forum.com/.
Brandon
2006-Apr-02 07:32 UTC
[Rails] Re: Scaffold Display Changes When Destroying Records
On closer examination of the source of my file, I found this code snippet that controls the delete dialog box: <a href="/bookmarks/destroy/27" onclick="if (confirm(''Are you sure?'')) { var f = document.createElement(''form''); this.parentNode.appendChild(f); f.method = ''POST''; f.action = this.href; f.submit(); };return false;">Destroy</a> The "form" element that the deletion confirmation creates is the cause of the extra whitespace when the "Yes" button on the dialog box is clicked. If I style the "form" element with a margin and padding of 0px, the whitespace does not appear when I destroy a record. I understand the security need to make a destroy request a POST request... but it seems like an extra step to create a form style that will "hide" the whitespace that is created when destroying an element. Is there any other way around this besides removing :post -> ''true'' from my link_to action? Brandon -- Posted via http://www.ruby-forum.com/.