Select all or more rows from the database to delete

Hello community and team Wappler.io Glad to join you. I apologize in advance for the grammar and the quality of the text, because I use google translator because of my poor knowledge of English.

Wappler caught my attention after Bubble.is. Despite the fact that the latter is a wonderful product, it seems that Wappler has a much greater potential for use. It is more flexible and promotes the right approach to the freedom of choice of the location of the project. However, at the moment, Wappler has a much smaller community (including Russian-speaking users) and training materials (both video and text format). This makes it harder to learn Wappler. I hope that this will not prevent me from mastering this wonderful product and creating a lot of beautiful and functional applications based on it.

At this point, I’m facing the following difficulty:
How to implement the following tasks (for better understanding made notes on the screenshot)?

  1. When you activate the checkbox (2), all the checkboxes from the area (3) become marked, and in the area (1) you can see how many records are marked. If you uncheck the checkbox (2), all checkboxes in the area (3) should also disappear.
  2. If no checkboxes are marked in area (3), button (4) is inactive. After one or more checkboxes from the area (3) become marked, the button (4) becomes active and when it is pressed, the selected records are deleted from the database.

I would be grateful for any advice, but a step-by-step explanation of how these tasks can be implemented would be especially valuable, it will allow a better understanding of the Wappler logic. I also note that at the moment I have studied all the video materials made by @Hyperbytes and @psweb (I am very grateful for the content), as well as the available documentation. In addition to looking for a solution here on the forum, but found tasks differ from my own, and without sufficient detailed explanations. So I decided to create this topic.

PS Very lacking documentation which describes the entire interface of Wappler and its functions, with examples of use, as is done in Bubble. That documentation that is at the moment helps very much, but unfortunately considers only certain, special cases. A very large part of the interface remains without explanation of use, which complicates the development of the program.

Thanks in advance! All success and luck!

2 Likes

Hello @Mr.Rubi ,

Welcome first. Remember that you can get support for any questions you may have. Up to now, the wappler team has provided quick and easy solutions to many problems we want. Ask any questions you may have in mind, or feel free to specify new features you want.
it is actually difficult to prepare a sample for each subject. It’s easy with the wappler you want to make sure.

Each checkbox must have a value (numeric) and you will post these values one by one to delete them. (with server-side repeater)

Watch this link and you can get the result you want with little change.

If you don’t get the result you want after a few attempts, let us know. We give our best support.

1 Like

Hello @s.alpaslan,

Thank you for your prompt response and recommendations. I have studied the suggested tutorials and I have no problem with creating a functionality that removes one selected entry using the button in the entry line (as shown in the example). But I can not apply the approach to solving the problem described by me in the first post, despite the fact that I have made many attempts and tried different options. I would be grateful if you can explain step by step solution.

Thanks in advance!

I note that the main steps are clear to me, so I will outline more specifically the step that I can not solve at the moment:

  • How to make that when marking the checkbox, the record id falls into the form field, which is associated with the server action and participates as a filter in the removal request? In other words, I have problems with the construction of the condition that when marking the checkbox, the conditions of using the dynamic filling of the form field work.

%D0%A7%D0%B5%D0%BA%D0%B1%D0%BE%D0%BA%D1%81%D1%8B3

Hi @Mr.Rubi,
You need to pass the selected IDs to the delete record step.
Make sure your checkboxes have the same name, ending with []
Example: mycheckbox[]
Then add dynamic values to them, using dynamic attributes > input > value and this should be the record id.
Then, under post variables in server connect, make sure “multiple” is selected for the checkbox post variable.

Finally, in delete record step free the records to be deleted using the IN operator, and select your checkbox post variable.

1 Like

Thanks for recommendations @Teodor, but I haven’t been successful yet.

Below I will describe in steps all the actions that I have done, with explanatory screenshots:

  1. In the generated table, I created a separate column in the cells of which I inserted the form (1). In form (1) I created the checkboxes (2), I gave them a name as You recommended, with the ending (3). Assigned them a dynamic attribute in the form of a record ID from the database (4). Then I created a server action (5) in which I loaded the checkbox (6), I checked that multiple was marked. Then I created a database connection and a deletion request (7).

  2. I went to the query settings (8) and set the condition you recommended (9).

  3. I then created a connection to the server on the App side (10). I linked the connection to a server-side action (11) and also disabled the auto load (12). After that I created dynamic events for successful and unsuccessful server action (13). In case of success, I set out to not only triggered an alert about the success, but also updated the table with data.

  4. I created a button to activate the uninstall (14). I tied the start of the server action to a click on the button (15).

If you check any checkbox and press the delete button, the request will be successful (there will be a success message), but the record will not be deleted. The record will remain intact. Can you tell me where I made a mistake?

Thanks in advance!

Ah, sorry my bad I’m away from my computer so I must have confused your request with some other’s so my explanation is wrong :slight_smile:

After you create your checkboxes and add the names ending with [] please create a repeat step in the server connect steps. Use the checkbox post variable as an expression.
Then in the repeat steps add the delete record step and for the delete value use {{$value}}.

The repeat step will will loop through the checked values and delete every record selected there.

1 Like

@Teodor, I do not fully understand what I need to do on the server side (what steps to add and where) to make everything work as it should. Could You make a couple of screenshots of the screen what exactly should be done and where? It would help me to understand the problem.

Thanks in advance!

Unfortunately I am not in front of the computer, so I can’t really make any screenshots.

  1. In the server connect steps add new step -> core actions -> repeat
  2. For the repeat expression use the checkbox (under $_POST variables) - just select it from the data picker.
  3. Inside the repeat steps add the database delete step.
  4. For the delete value/filter just enter {{$value}}

That’s all.

1 Like

So what did I do:

  1. Instead of the delete step, I created a repeat step as recommended (1). In the properties in the expression field, I specified a variable from $_POS, which is a checkbox (the name ends with two square brackets) (2).

  2. Inside the repeat step, I created the delete step as recommended (1). In the settings, I chose “$value” (2) as the deletion condition. I tried both IN and equal as an sql query operator (3).

Deletion of records is still not working. Where did I make a mistake?

The operator must be EQUAL, not IN, the rest looks good to me.

As I wrote above, I tried both operators. Unfortunately, with the EQUAL operator, the entries are not deleted either. What else could be wrong?

P. S. perhaps someone from users already implemented similar task and can show what settings he did? I would be very grateful for your help.

Making many attempts, I noticed the following pattern:

  • If to the element (for example the button) to apply such dynamic attribute as “disabled”, and in a condition to put “checked” of a checkbox (which costs simply in a table header and is responsible for marking of all checkboxes in a column), everything will work OK!

  • But if the conditions apply “checked” checkbox, which is installed inside the form, the trigger will not work.

For some reason, checkboxes inside the form cannot participate in conditions not only with “disabled”, but also with other dynamic attributes. I do not know the error or not, but perhaps for the same reason, the server does not respond to these checkboxes during the execution of the removal request?

PS I also come a follow up question:

  • I understand how to make the element to be “disabled” under the condition of “checked” checkbox, but I need the reverse situation, I want the element to be “disabled” until the event “checked” checkbox. How to achieve this?

The silence in the topic from the community and the Wappler team made me wonder:

  • Are my posts and wording of my questions clear? (because I use Google translate to translate into English)

Actually your last post is not clear at all.
If you follow the steps I provided, then go and select multiple checkboxes with your mouse then hit the delete button, the records will be deleted.
I’m not sure what conditions/checked/disabled are you referring to exactly.

1 Like

The main problem is that if I do everything as you said (confirmation that I made screenshots of the screen), I can not delete the record. Uninstalling just doesn’t work.

In the last post, which You do not understand, I made an assumption why the removal request may not work, when selecting the checkboxes with the mouse and then clicking the delete button.

To sum up, at the moment I have one main question:

  • How to make when selecting checkboxes with the mouse and pressing the button, the selected entries are deleted? (at the moment I did everything as You said, but it did not bring the desired result)

And a few additional questions that I will not raise yet, so as not to overload this topic with unnecessary information and not to confuse You.

If something seems unclear in my post let me know, I will try to rephrase the text to be more understandable for perception.

And thank you for Your help.

It should be done as per my explanation.
If it doesn’t work, then I will need some link to your page where I can debug what’s wrong.

1 Like

Before Your previous post I worked on local WAMP, but due to the fact that I need to provide You with a link to the page, I started working with hosting. I didn’t think it could turn into a whole challenge… I spent the whole day to find a suitable hosting with which all Wappler connections would work. I had to go through 12 different web hosts to find the one that will be able to earn Wappler. But in the end the connection is established and the page works and to some extent I’m happy.)

I would be absolutely happy if You can figure out the problem due to which the deletion of the selected records does not work and point out my mistakes. Here is my page: http://co43498.tmweb.ru/

And thank you for helping.

Hi @Mr.Rubi,

What you have on your front end page mixes a couple of different approaches, so I’ve dragged some things around to hopefully get you closer. I have no visibility to your server connect, but these front end changes should give you a good chance at success.

Basically what I have done is produced a single form (you had originally done one form for each row in your query.) This single form, now includes the delete button as a submit (rather than calling a separate server connect action.) What this does is creates one form with all the checkboxes included, which when submitted, will send an array of checkboxes that are to be deleted.

It looks like this:

See if this file works for you…index.html.zip (2.7 KB)

–Ken

2 Likes

I’m sorry, but there’s no such thing as a Wappler suitable hosting. Wappler connects to any hosting out there, just as any other ftp program you may be using. If you are not able to connect to a hosting server, then you need to double check the ftp configuration and the error messages displayed.

Anyway, thanks for the link I will check this.

1 Like