Forums

ASP

This topic is locked

insert default value

Posted 03 Oct 2001 07:30:02
1
has voted
03 Oct 2001 07:30:02 snakk jenson posted:
hi there,
I'm trying out uploading files with PureASPUpload and use the insert record SB to
insert file names into my access database. On the upload page there are 3 file fields and they will be optional.

the problem is when any of the file fields is left blank when submited, it will insert a zero-lengh value into the database imagePath field. As I know, the insert record behavier is excuted after the files have been uploaded, so is there any way to modify the UD insert record codes to provide a default value (let's say "none.gif" instead of a empty value?

I've try typing none.gif in the file field manually but that will get error message from ASPUpload. I need a file name in every database fields and actually I've tried the default value in the database too, but it won't work since the zero-lengh value overwrite it.

Is there anyone could help? I guess this is a simple task and can be solved with something like a <% If theFieldValue = "" then theFieldValue = "none.gif" %> statement, but I am such a newbie who can't get it work.
All comments are appreciated!

snAkk


Replies

Replied 10 Oct 2001 19:07:10
10 Oct 2001 19:07:10 Joel Martinez replied:
doesn't the insert record behavior have a default value field? ... if you can't find it on the SB UI... you should be able to look in the code, and find something like:<pre id=code><font face=courier size=2 id=code>dim yourVar
yourVar = ""
<b>IF</b> request("yourVar" &lt;&gt; "" <b>THEN</b>
yourVar = request("yourVar"
<b>END IF</b></font id=code></pre id=code>Just change the second line on the field in question, and that will be the default.

Joel Martinez [ ]
----------
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/

Reply to this topic