Discussion Board - How to avoid the user from sending an incomplete form?
When we write a script, we need to make sure that the user had completed the form.
So How can we avoid the user from sending an incomplete form?
Below are the ASP scripts and descriptions:
<%@LANGUAGE="VBScript"%>
<%
'First we get the value from the submit form
strUser = Request.form("user")
strTitle= Request.form("title")
strContent = Request.form("content")
%>
Post Your Message
<%
‘Now, we check any variable is empty, if any variable is empty, which means the form is incomplete! We need to display the form again.
‘Another case is when we start a new discussion, all variable will be empty
If strUser="" or strTitle="" or strContent="" Then
%>
User > Title > Message
<%
Else
%>
We will save this message.
<%
End If
%>
When the user had not completed the form, the system will return a same form to the user after the user clicked on the Post button:
When the user had completed the form, this message will be displayed:
No comments:
Post a Comment