This topic is locked
[SOLVED]

 Validation to the Add.Asp pages

2/23/2006 2:49:43 PM
ASPRunnerPro General questions
S
stewglyn author

I am trying to achieve some validation on my add.asp pages. I have a Field, which holds Date Set (this is the date a Teacher sets a piece of homework). I also have a Date Due Field (this holds the date a Teacher wants the work returned).
When a user fills in this Form, I want to make sure that the Date Due Field contains data which is > greater than that contained in Date Set. So I am comparing the two. I have managed to quickly set it out in Access like below:
Private Sub DatedueAfterUpdate()

Dim strmsg As String

Dim holddateset As Date

Dim holddatedue As Date
strmsg = "Please ensure that your date due is a later date than is contained in date set"
Form
addnew.dateset.SetFocus

holddateset = Formaddnew.txtdateset.Text
Form
addnew.datedue.SetFocus

holddatedue = Form_addnew.txtdatedue.Text
If CDate(holddateset) >= CDate(holddatedue) Then
MsgBox strmsg, vbCritical
End If
End Sub
Can anyone comment on the necessary changes required to complete this validation to the Add.asp template? Does it need to be a server side action or can it be done at the client end??
Many thanks for any help..

stewart

Sergey Kornilov admin 2/24/2006

Stewart,
you can use BeforeAddevent in ASPRunnerPro 4.0 for this purpose. Compare dates and return False if you like to cancel record addition. See sample actions for more info.

S
stewglyn author 2/24/2006

Thats great thanks, I was trying to cobble together a piece of javascript then fit it in but that sounds cool

many thanks
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=8184&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />