Delete button not working properly

birwel - September 5, 2009 - 19:47
Project:Image Upload
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Follow these steps:

1) Click on create content >> whatever you want
2) Upload an image
3) Check de image, and the push the Delete button

This causes the form to submit, instead of doing the ajax call, and the item is not deleted.
Seems that when you upload an image, the image_upload_js function rebuilds the form, and the ahah of the Delete button does not work.
You can check this because after uploading an image the class of the Delete button is class="form-submit" instead of class="form-submit ahah-processed".

When the form is fully submitted, then the Delete button class is class="form-submit ahah-processed" and it works.

Maybe the del button ahah content doesn't work if it hasn't been initialized in the $(document).ready because it didn't exists in the .ready event.
Perhaps loading initially the button as "hidden" may be a solution ?

#1

birwel - September 6, 2009 - 10:42
Title:ahah-processed class not working when deleting an item» Delete button not working properly

I can confirm that rendering the Delete Button (in hidden mode if there's no images to list) in the first form load solves the problem.

#2

bojanz - September 8, 2009 - 22:00

Could I get this as a patch, please?

#3

birwel - September 10, 2009 - 13:38

Sorry I haven't done it. Just changed the delete button creation position (to be always created) and I noticed that It worked.

 
 

Drupal is a registered trademark of Dries Buytaert.