This has been bugging me for some time now. I get a (dynamic) list of a product name and description from a database that is loaded into arrays. I then display the product name and allow the users to edit the descriptions. I loop thought the arrays and use the following for the description: <input name="productDescription(<%=h%>)" size=50 maxlength=75 value="<%=productDescription(h)%>">
The issue is I want to validate that there is a description when they click the submit button. I have tried this and it does not work.
Function UpdateProductDescription_onSubmit()
Dim h, errorFound
For h = 1 to document.UpdateProductDescription.nbrofrecords.value
If Len(Trim(document.UpdateProductDescription.productDescription(h).value)) = 0 Then
str = alert("Product Description is Required")
errorFound = “True”
Exit For
End If
Next
If errorFound = “True” Then
UpdateProductDescription_onSubmit = False
Else
document.UpdateProductDescription.action = "test.asp"
UpdateProductDescription_onSubmit = True
End If
End Function
The issue is I want to validate that there is a description when they click the submit button. I have tried this and it does not work.
Function UpdateProductDescription_onSubmit()
Dim h, errorFound
For h = 1 to document.UpdateProductDescription.nbrofrecords.value
If Len(Trim(document.UpdateProductDescription.productDescription(h).value)) = 0 Then
str = alert("Product Description is Required")
errorFound = “True”
Exit For
End If
Next
If errorFound = “True” Then
UpdateProductDescription_onSubmit = False
Else
document.UpdateProductDescription.action = "test.asp"
UpdateProductDescription_onSubmit = True
End If
End Function