Re: New Era: Validating a date problem
Posted in 1998
Hi John, First question, why do you use a textbox and not a superField. If you use a superField in stead of a textBox all checking is done for you by the superField; you are forced to enter a correct date. Could this eliminate your problem? If you want to use a textBox anyway, you might consider copying the textBox value to an ixDate variable. I'am not quite sure if this can prevent the data conversion error. Another alternative is to use the textBoex in combination with a hidden superField and copy the textBox value to the superField of type SQLDate. If conversion fails, the conversionFailed event of the superField is raised. The handler for this event could implement the logic to handle this situation. Success, Henk John Clynes wrote: > Hi, > I'm new to New Era (v2.12) and am having difficulty validating a date. > > Basically, I have an character string pulled from a text box. No problems. > This string should be a date so when I post the data in the form I check > that the > text pulled from the text box is like a date before trying to update the > database. e.g > > WHENEVER ERROR CONTINUE > VALIDATE mtStr LIKE dbname.dob > WHENEVER ERROR STOP > > When I submit the info (with an invalid date) I get an error - bad string to > date conversion error. > > I've declared the database name so it knows where to look, just seems that I > can't trap the error before it gets to the database side. If I enter a valid > date, there's no problems. > > Can anyone point me to where I'm going wrong or how they would normally > validate a date. > > Thanks for any replies > John