Forums

Edit form: remove value from cell

flyboeing 05 Feb, 2013
Hi all,

I created an edit form for my records database. When edit a record, all the information of that record is shown.
Forums image 1
Forums image 2
As you can see there is an image in this record. The main thing I would like to have is a delete button next to the image, so if I click on the button, the image and the photograph will be removed from the record and the status will be reset to No.

Does someone have any idea how I can do this?
GreyHead 05 Feb, 2013
Hi Ruud,

Please see this FAQ. There was also a recent thread about this where some changes were suggested.

Bob
flyboeing 05 Feb, 2013
Hi Bob,

Thank you for you reply.
The FAQ is for the new CF(version 4). In my case I am still using the CF v3.2. In there there is no Ghost tab.
GreyHead 05 Feb, 2013
Hi Ruud,

The ghost tab just adds a hidden input with the same name. You can do that in CFv3.2

Bob
flyboeing 05 Feb, 2013
Hello Bob,

Tonight I was trying to make this work in CF V4 (eventually I have to switch to that version🤣). I got it partly working but still some strange things are happening.

I made my form and used this thread to get my problem with the image working.

I used your Upload Files [GH] for creating a dynamic upload path. The filename and the image are uploaded and the name of photographer is also saved to the database.
Now I am getting this strange thing. I've got the checkbox for deleting the filename from my database. This is working. I also have to radiobuttons with the options "Yes" and "No". If the option is "Yes", the image is visible in my CC list. If the option is "No" it is not visible. The standard value of this column is "No". When the image is uploaded I change this to "Yes" (image is visible in CC). This works perfect. Now comes the thing I don't get. I change it back to "No" and my filename is gone from my database!? (the name of my radiobuttons is 'Status'). I didn't change a thing with the checkbox from the link above.....

I was also wondering, if the filename is deleted, can this option be extended so the photographer will also be removed from the database? The best thing is that the file is also removed from the server. Is that possible by coding?

Regards,
Ruud
GreyHead 22 Feb, 2013
Hi Ruud,

I have no idea why the 'Status' radio button would cause the image to be deleted. The most likely reason is that in this case the 'image' input name appears in the form data but is empty. That's why we ended messing with unsetting the file upload values to prevent image names from being deleted by mistake.

You could remove the photographer data by using a little PHP to set the photographer input to '' when the image is deleted.

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger