Jean,
Don's answer should fix the errors that you're seeing. Basically, that is
saying, "I don't care if the field is blank. Do it anyway." You're allowing
Null values in your tables. Not a bad thing, but if you REALLY need a value
in there, then you'll have to make sure one exists or create your own
default value before the insert.
Which brings me to my comments...
First, as your coding skills and experience improve, you will find it less
and less necessary to use cfinsert and cfupdate. Those are both very
inflexible tags that, while they work in simple situations, they are not the
preferred way of doing even simple operations. Get used to using cfquery and
writing out the SQL for each query. You'll find it's more maintainable, far
more flexible, and easier to solve problems. When you get up to SQL Server
or Oracle, learn how to write Transact SQL or PL/SQL in order to move the
data operations out of CF and into the database where the work can be
performed much more efficiently.
Second, the best way to get the current date in the database during an
insert is to let the database do the work. Using Access set the desired
field to have a default value of Now() (or use GetDate() in SQL Server).
When you insert the record, don't pass in a date and the database will
automatically insert the current date/time.
Good luck,
Jeremy
> -----Original Message-----
> From: Don Wagner [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 05, 2001 10:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Form submission problems
>
>
> Jean,
>
> If you are using Access for your database, one of the field's
> properties is
> "Allow Zero Length". If this is set to No, you will receive the error
> message such-n-such field can not have a string length of 0
> when there is no
> data in that field. If it is No, try setting it to Yes and
> see if that
> takes care of your problem.
>
> Don Wagner
>
>
> ----- Original Message -----
> From: "Jean" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, March 05, 2001 10:23 PM
> Subject: Form submission problems
>
>
> > I have a form. I need one of the things that happens on
> submission is
> > for the current date to be put in the database. The only
> way I knew to
> > do this is with a SQL insert instead of a cfinsert. This part works
> > fine. The part that isnt working is some of the form boxes
> need to be
> > required, and some need to be validated too, but some need to be
> > optional. So I have cfinserts and a SQL statement. When
> the optional
> > form fields are left blank, I get an error message that such-n-such
> > field can not have a string length of 0. I checked the
> database, none
> > of the fields are required in the database itself, and I have tried
> > making the non-required fields cfinserts too with required="no" and
> > this does not work either.
> >
> > I am having the same problem with text areas.
> >
> >
> > PS
> > I have updated my e-mail address in the profile on the dfwcfug home
> > page, but I have yet to recieve mail at my new address. Is there
> > something else I needed to have done?
> >
> > =====
> > Veni, Vedi, Velcro.
> > I came, I saw, I stuck with it.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get email at your own domain with Yahoo! Mail.
> > http://personal.mail.yahoo.com/
> >
> >
> --------------------------------------------------------------
> -----------
> > This email server is running an evaluation copy of the
> MailShield anti-
> > spam software. Please contact your email administrator if
> you have any
> > questions about this message. MailShield product info:
> www.mailshield.com
> >
> > -----------------------------------------------
> > To post, send email to [EMAIL PROTECTED]
> > To subscribe / unsubscribe: http://www.dfwcfug.org
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.231 / Virus Database: 112 - Release Date: 2/12/2001
>
>
> --------------------------------------------------------------
> -----------
> This email server is running an evaluation copy of the
> MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info:
> www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
>
-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com
-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org