close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DataAssist not deleting the correct record from a repeating region

Thread began 9/13/2014 8:46 am by acaciasd344844 | Last modified 9/19/2014 11:19 am by Jason Byrnes | 688 views | 5 replies |

acaciasd344844

DataAssist not deleting the correct record from a repeating region

DataAssist not deleting the correct record from a repeating region

Using dataAssist 2.1.0. DreamWeaver CS3 MySQL 5.0.10 PHP 5.4 Windows XP Pro

I am a bit baffled here, I have a repeat region that displays a record set of different food products. I have also inserted a button next to the product name within this repeat region so that when a button is clicked it should delete the appropriate record by the record ID number. But, what is actually happening is, that it is deleting the last record in the repeating region and unfortunately not the one I selected. I have hunted everywhere on the page to see what I am doing wrong but I just cant see it. Hope you can help. John

Sign in to reply to this post

Jason ByrnesWebAssist

you need to add code to the submit button to set a hidden element to the selected ID


create a hidden form element on the page named deleteID, make sure deleteID is used for both the name and ID of the hidden element.

then edit the submit button to add an onclick event to set the deleteID:

<input name="deleteproduct" type="submit" class="custom_button_red" id="deleteproduct" value="-" onClick="document.getElementById('deleteID').value=<?php echo $row_Recordsetfindallprodid['johnsid']; ?>">



then in the delete record behavior, set the delete ID to use the deleteID hidden element.

Sign in to reply to this post

acaciasd344844

DataAssist not deleting the correct record from a repeating region

Hi Jason,

Hope all is well, thanks for that, I will give it a go right now.

Thanks

John

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

acaciasd344844

Hi Jason,

I gave the button code another go but yet again its doing the same thing, deleting the last record in a list rather than the one selected. I followed your instructions by adding the following code

<input name="deleteID" type="hidden" id="deleteID" value="<?php echo $row_Recordsetfindallprodid['purchaseid']; ?>">
<input name="deleteproduct" type="submit" class="custom_button_red" id="deleteproduct" value="-" onClick="document.getElementById('deleteID').value=<?php echo $row_Recordsetfindallprodid['purchaseid']; ?>">

then amending the server behavior to point at the deleteID hiden element as shown below

<?php echo((isset($_POST["deleteID"]))?$_POST["deleteID"]:"") ?>

As I say I have tried numerous other attempts, but to no avail. It will not select the correct record id for deletion. I have tried it with hidden elements and text fields. I'm beginning to think it may be down to the MySQL code that is attached to the repeat region.

I did try something I created a temporary field and pointed it at the purchase recordid, then i created a simple link 'testlink' and pointed that at the same page and the temporary field. similar to the following.

page_4.php?tmp=<?php echo((isset($_POST["tmp"]))?$_POST["tmp"]:"") ?>

When hovering the mouse over the link, their is no value visible.

page_4.php?tmp=

So if no value is being sent to the server, I guess the delete behavior is just deleting the last record in the database table. I have had issues with the isset($_POST function before, so could that be the culprit, it is posting even though the variable is empty.

I'm not sure Jason, I'm no php developer at all

Thanks again

John

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post

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...