close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Multiple record delete page not deleting records

Thread began 4/15/2019 12:41 pm by MagsW | Last modified 4/17/2019 5:08 pm by Ray Borduin | 49 views | 11 replies |

MagsW

Multiple record delete page not deleting records

Hi Ray, I followed the tutorial on creating a multiple record delete page (although I'm using mySQLi) but when I select records and hit the Delete Selected button, it doesn't delete the records. Would you mind taking a look for me? I've attached the draft page.

Sign in to reply to this post

Ray BorduinWebAssist

You didn't assign a value to your delete checkbox. It needs a value or else it won't be included in the form submit. You can just set the value to 1.

Sign in to reply to this post

MagsW

I added value="1" to the checkbox, however it still isn't deleting any records. The checkbox code now looks like this:

<input type="checkbox" name="multidelete_<?php echo($wa_startindex); ?>" id="multidelete_<?php echo($wa_startindex); ?>" value="1" />

Sign in to reply to this post

Ray BorduinWebAssist

I'd need to debug this to determine why. That was the only issue I spotted. If you give me a URL where I can reproduce and FTP access so I can test and add debug code I'll be able to tell you what is going wrong.

Sign in to reply to this post

MagsW

Thanks Ray, details in PM.

Sign in to reply to this post

Ray BorduinWebAssist

I didn't notice that you have spaces in your form button name that you are using for the trigger. Spaces aren't allowed in form element names in php, they are automatically converted to underscores when posted and we aren't accounting for that in the trigger. I'll get that updated in a future release.

For now, either rename the form button and re-apply the server behavior with the new trigger, or you can manually update line 38 to:

if (isset($_POST["delete_chcked_items"]) || isset($_POST["delete_chcked_items_x"])) {

Now that I tested, I also see that the checkbox value has to be set to the ID of the record that you want deleted. I've updated both of these on your page and it seems to work now.

Sign in to reply to this post

MagsW

Thanks for sorting that out, it's working! The behavior generated the name and ID with the space. Might be worth updating the tutorial download file too, as the checkbox code given in that doesn't have a value:

<input type="checkbox" name="checkbox" id="checkbox" />

Sign in to reply to this post

Ray BorduinWebAssist

Can I get a link to the tutorial you are using? I don't think the behavior creates the button. That has to be step in the process. I'll take a look at the tutorial. I've already updated the extension code to replace spaces with underscores, so it will show up in the next build.

Sign in to reply to this post

MagsW

It's this one: http://www.webassist.com/tutorials/Create-a-multiple-record-delete-form

I downloaded the "sample_form_delete.php" file at the top of the page to check how the form and button were constructed. I manually gave the checkbox the name and id "multidelete" and I think the space may have been added when selecting it in the server behavior panel.

Sign in to reply to this post

MagsW

Hi Ray, just one more question - I'd quite like to include an "Are you sure" popup message when the button is clicked to prevent accidental deletion. I added the following code:

<input name="delete chcked items" type="submit" id="delete check items" value="Delete Selected?" onclick="doublecheck()" />

and the javascript:

<script>
function doublecheck() {
alert("Are you sure?");
}
</script>

but it doesn't do anything. I also tried applying Dreamweaver's default Popup Message Behavior which adds "onclick="MM_popupMsg('Are you sure?')"" to the button but that didn't work either. Is there maybe a conflict with the WA JQuery Validation already on the page? Anything else I could try?

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...