close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Deleting image on checkbox

Thread began 4/03/2012 8:35 am by dan361748 | Last modified 4/03/2012 11:45 am by Ian S | 1035 views | 1 replies |

dan361748

Deleting image on checkbox

Hi - I have an update form that is using DFP to upload an image.

I want to include a checkbox to delete the file and it's associated entry in field for the article record.

I have the file part figured out - it deletes the file properly if deleteimage is checked:

<?php
$WA_DeleteFileResult1 = false;
if(("". ((isset($_POST["deleteimage"]))?$_POST["deleteimage"]:""). ""
!= "")){
$WA_DeleteFileResult1 = WA_FileAssist_DeleteFile("cmsassets/featureimages/", "".$row_WADAarticles['article_imagefile'] ."");
}
?>

But I can't figure out how to make the article_imagefile field blank if deleteimage is checked. I'm trying to change the default image, figuring if that was blank on update it would solve this. I've tried:

My checkbox in the form:
<input name="deleteimage" id="deleteimage" type="checkbox" value="1" />

and also in the form:
<input type="hidden" name="article_defaultfile" id="defaultfile" value="<?php if(("". ((isset($_POST["deleteimage"]))?$_POST["deleteimage"]:""). ""
!= "")){ ?><?php } else { ?><?php echo($row_WADAarticles['article_imagefile']); ?><?php } ?>" />

But no workie.

Any help would be appreciated! Is this the right way to do this?

Sign in to reply to this post

Ian S

Do you have DataAssist?

The way that I do this is to use the Update Behaviour. Now, to the best of my knowledge you cannot enter a blank value using this, so what I do is place some text in the field I want to update (the file field), say ABC and then save the behaviour so the code is written to the page.

Then go into the code view and simply remove the ABC text from the code so that the string is empty.

You could also have an empty hidden field on the form and bind that to the file field on update, as long as the trigger of the update is your checkbox.

Hope that helps?

Cheers
Ian

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