close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

File field update form

Thread began 2/13/2010 7:32 pm by nickj | Last modified 2/15/2010 9:39 am by nickj | 1759 views | 7 replies |

nickj

File field update form

In a update form I have a file field, (in the insert form this is to add an image to the record). How do I set the initial value so that if I choose not change the image file, the original one is not over written by a blank value?

Sign in to reply to this post

anonymous

Nick,

Are you using Digital File Pro as well to do this?

Sign in to reply to this post

nickj

Yes, I tried adding value="<?php echo(str_replace('"', '&quot;', $row_WADAimages['title'])); ?>" to the field definition but that didn't work. I have not tried using a "show if" based on the recordset.

Sign in to reply to this post

anonymous

Hi Nick,

The best way to do this is:

Inside your form with the update file field, create a hidden field beside it and store the name of the original file from the recordset in the hidden field.

Then in digital file pro, for the default file name, hit the lightning bolt and set it to the hidden form element.

Then, open the DataAssist server update behavior... be sure to set the column that holds your image name to the Digital File Pro server file name. Now, if you have a new file, it will use that... if no new file is added, it will revert to what you specified as default.

I typically use a naming convention like "image" for the hidden field and "imagefile" for the new file field.

Let me know if you have any issues,

Brian

Sign in to reply to this post

nickj

Great, I'll try this. If I build my initial files with DATAASSIST I don't have the option of setting the fields type to: file. What is the best practice for converting the text field to a file field prior to applying DigitalFile?

Nick

Sign in to reply to this post

anonymous

Nick,

At first just leave it as a text input... then go in to your code and change the original to "hidden" and then add the file field beside it and name the new file field accordingly (such as use the same file name as your original and add "file" onto it).

Sign in to reply to this post

anonymous

Nick,

Another thing you may want to do when you have the update process complete, you can add a delete file behavior that is triggered when a new upload is successful... so you could delete the old file upon the success of a new file being uploaded. I like to do this so that I don't have a bunch of images "floating" around on the server unnecessarily.

Regards,

Brian

Sign in to reply to this post

nickj

OK, thanks. Now the other fiels I created using DataAssist are OK so I probably need to redo the update file, is it best to start from scratch, use the Dataassist wizard of another behavior to re-create the update form?

Nick

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