Data not deleting and modal not closing

I’m trying to delete db records from a “Delete” button within a modal and a Bootstrap 4 dynamic form. It’s an image gallery and I’m trying to delete a gallery and all the images included.

Using this tutorial that @ben made:
https://community.wappler.io/t/started-a-tutorial-on-how-to-create-an-image-gallery/3744

Here’s the specific video:

https://youtu.be/KWlTz2rUdbU

So the page’s modal pops up when the “Delete Gallery” button is clicked but when I click the “Delete Gallery” inside the modal, nothing happens.

I tried fixing it with the issues described in this post:

Delete/Edit Record Actions Do Not Work in a Modal

but I must be doing something wrong because I still can’t get it to work.

Here’s what my app structure looks like:

And here is what the modal properties look like:

Here are my dynamic events:

Full disclosure . . . I’m not very good at this coding stuff (which is why I chose Wappler). I appreciate all of the advice, tutorials and helpful people I meet in this community.

Thank you again.

Edit: added @ben for credit.

Here is the live site

http://mzimmermanphoto.com/admin/

Feel free to add / edit / delete. It’s all test data and will be password protected after I get my act together and fix all the issues.

For the delete action, I see this code:

> <div class="modal-body">
> 	    <form is="dmx-serverconnect-form" id="mdlGallery_Delete" method="post" action="../dmxConnect/api/Galleries/delete.php" dmx-generator="bootstrap4" dmx-form-type="horizontal" dmx-populate="ddGallery.data" dmx-on:success="scGalleries.load();mdlGalleryDelete.hide()">
> 		    <input type="hidden" name="galleryID" id="input_galleryID" dmx-bind:value="ddGallery.data.galleryID"></form>
> 		    <p>Are you sure you want to delete this gallery and ALL images inside? <br><br>This action cannot be undone.</p>
> </div>
> <div class="modal-footer">
> 		<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
> 		<button type="button" class="btn btn-danger">Delete Gallery</button>
> </div>

First, there is no end <form> tag after the paragraph.
Secondly, because the Delete button is outside of the form, you will need an on-click event to submit the form.

1 Like

I suspect the button is outside of the Form
You could either:

  1. Move the button to inside the form
  2. Add a dynamic event to the button and choose the form submit option.
1 Like

Ah @ben, you are too quick…

1 Like

There is a closing form tag on the line before the paragraph and with no inputs after that point it is OK.

1 Like

Whoo hoo!
That did it. Thank you!

1 Like