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

Bind checkbox to file name column when deleting file

Thread began 4/15/2011 1:05 pm by troyd | Last modified 4/15/2011 4:37 pm by Jason Byrnes | 1446 views | 5 replies |

troyd

Bind checkbox to file name column when deleting file

I have an update form with 3 images. I need to add checkboxes next to each image so that when checked, will delete those images on update.
This is working fine and the image is deleted. But the file name remains in the column.

What I have so far;
-Update behavior for the database. Triggered by the Update button being pressed.
-Upload file behaviors (one for each file field). Default is server filename.
-Delete file behaviors (one for each file field), triggered if it's checkbox is checked.

What I am trying to figure out is how to tell the update behavior that if the checkbox is checked, to clear that column only.

I tried going with the thread #19034. But the client really wants checkboxes so they can update the other fields and delete an image at the same time.

Any help would be appreciated.

Thanks,
TroyD

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of your page, so i can see the code, and i can tell you what to change.

Sign in to reply to this post

troyd

Thanks Jason, Here you go.

TroyD

Attached Files
tblavailable_UpdateWA.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

change line 55 and 65:

php:
'DefaultFileName' => "".((isset($_POST["imagename"]))?$_POST["imagename"]:"")  ."",



to:

php:
'DefaultFileName' => "".((($_POST["deleteimage1"] != "delete"))?$_POST["imagename"]:"")  ."",




change line 79 and 89:

php:
'DefaultFileName' => "".((isset($_POST["imagename2"]))?$_POST["imagename2"]:"")  ."",



to:

php:
'DefaultFileName' => "".((($_POST["deleteimage2"] != "delete"))?$_POST["imagename2"]:"")  ."",



and change line 103 and 113:

php:
'DefaultFileName' => "".((isset($_POST["imagename3"]))?$_POST["imagename3"]:"")  ."",



to:

php:
'DefaultFileName' => "".((($_POST["deleteimage3"] != "delete"))?$_POST["imagename3"]:"")  ."",
Sign in to reply to this post

troyd

Wow Jason, as always thanks so much. That worked perfectly.

Just for my own study and understanding. What you did there was tweak the file Upload behavior to use the default name as before but only if the checkbox did not post the value of "delete"? And if it did post the value of "delete" to use a blank value as the default?
Is that correct?

I just wanted to make some notes. But either way, thanks.

TroyD

Sign in to reply to this post

Jason ByrnesWebAssist

Yes Troy, that's spot on.

the code is using a ternary condition to use the regular default image if the delete checkbox does not pass the value "delete" and a blank string if it does.

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