close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Delete Image File on Update page

Thread began 3/22/2010 4:00 pm by troyd | Last modified 3/25/2010 10:23 am by Ray Borduin | 1288 views | 13 replies |

troyd

Delete Image File on Update page

I have asked this question before, but in a totally different context. And I can't seem to figure out how to do it on an update page.

What I have are 4 possible images for a record. The user might include 1, 2, 3 or 4 images and later update them. That's all fine.

But they want to be able to delete an image and not just update it. So for example a record has 3 image. They want to delete #3 leaving it blank.

What I would like to do is include a checkbox next to each image thumbnail on the Update page. If checked, that image will be deleted and the record table updated when they submit the Update. How would I bind the "File Manipulation" behavior to be triggered by the checkbox if checked?

Thanks,
TroyD

Sign in to reply to this post

Ray BorduinWebAssist

If you specify the checkbox from the form as the trigger, it will only fire when it is checked.

Sign in to reply to this post

troyd

Thanks Ray. But when I did that, it broke the delete file behavior.

When I set the trigger to be the checkbox, the behavior disappears from the behavior list. The checkbox in this case is named "cb_deleteimage2"

Here's the code generated by the UI4 file manipulation wizard.

php:
<?php

$WA_DeleteFileResult1 
false;
if((<?
php echo((isset($_POST["cb_deleteimage2"]))?$_POST["cb_deleteimage2"]:""?>
!= "")){
    $WA_DeleteFileResult1 = WA_FileAssist_DeleteFile("../../../images/collection/", "".$row_rsCollection['imagethumb2']  ."");
}
?>



It looks like a syntax error maybe? But I'm still learning this so I don't see it.

TroyD

Sign in to reply to this post

Ray BorduinWebAssist

looks like that could be a bug in that server behavior... it should have been:

<?php
$WA_DeleteFileResult1 = false;
if(("". ((isset($_POST["cb_deleteimage2"]))?$_POST["cb_deleteimage2"]:""). ""
!= "")){
$WA_DeleteFileResult1 = WA_FileAssist_DeleteFile("../../../images/collection/", "".$row_rsCollection['imagethumb2'] ."");
}
?>
Sign in to reply to this post

troyd

Ok, that removed the error but it doesn't delete the file when I check the box.

What should the value of the check box be? Maybe that's where I went wrong.

One other thing, the delete file behavior does not show up in the behaviors list using that code. Is that an issue?

Thanks,
TroyD

Sign in to reply to this post

Ray BorduinWebAssist

The checkbox value can be anything as long as it isn't blank.

Sign in to reply to this post

troyd

Thanks Ray.
Then that's not the problem. Any other thoughts?

TroyD

Sign in to reply to this post

Ray BorduinWebAssist

It is too hard to say without debugging. I'll open a support ticket so that we can research this with you directly.

Sign in to reply to this post

John LangerBeta Tester

Originally Said By: Ray Borduin
  It is too hard to say without debugging. I'll open a support ticket so that we can research this with you directly.  



I'm watching this thread with interest. Could the resolution of this problem be posted back please?

Many thanks.

Sign in to reply to this post

troyd

Just to update. This was totally user error (me) after the point where Ray showed me the correct code. I was being stupid and didn't include a second delete behavior for the thumbnail version. So it was deleting the large image and yet I was seeing the thumbnail and thought it wasn't working. Sorry about that.

On the other issue. The delete file behavior still does not show up in the DW list of Server Behaviors. Is this normal since it is using a check box as a trigger? So I can't reenter the UE4 wizard.

(Ray, I updated the ticket with a copy of the page)

Thanks,
TroyD

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