Académique Documents
Professionnel Documents
Culture Documents
Now this is the last topic of the tutorial and you will learn how to validate and submit the
data to the web server.
The process to validate the forms are as under. The two things should be checked.
In the above example first we are checking whether the user has entered any value or not.
If he has not entered any value we will prompt to enter any value. Second validation is
that if he has entered any value , just check whether the data entered is numeric or not. If
the data is not numeric prompt him to enter the numeric value otherwise move to next
step. In the next step we are validating that the age value is entered as per the prescribed
range or not.
At last if all the validations are met by the user , he will be shown a message that “Thanks
for providing your age” and this data will be submitted to the web server.
Example :
Sub cmdCalculate_OnClick
Dim AmountofDiscount
Dim AmountofTax
Dim DISCOUNT_LIMIT
Dim DISCOUNT_RATE
Dim SubtotalBefore
Dim SubtotalAfter
Dim TAX_RATE
Dim TotalCost
If (Len(Document.myform.txtQuantity.Value) = 0) Then
MsgBox "You must enter a quantity."
Exit Sub
End If
If (Len(Document.myform.cmbProducts.Value) = 0) Then
MsgBox "You must select a product."
Exit Sub
End If
End Sub
Sub cmdSubmit_onClick
' Submit this order for processing.
MsgBox "Your order has been submitted."
Document.myform.Submit
End Sub
Sub cmbProducts_Change()
Select Case Document.myform.cmbProducts.Value
Case "NEC MultiSync E1100"
Document.myform.lblUnitCost.Caption = 1590
Case "NEC MultiSync P1150"
Document.myform.lblUnitCost.Caption = 880
Case "NEC MultiSync E750"
Document.myform.lblUnitCost.Caption = 1940
Case Else
Document.myform.lblUnitCost.Caption = 0
End Select
End Sub
-- >
< /SCRIPT >