Forums
This topic is locked
Form won't work unless fill in all fields!
Posted 14 Oct 2006 00:17:59
1
has voted
14 Oct 2006 00:17:59 Tina Paulus posted:
My forms work fine as long as all the fields have something put in them. How can I fix so I don't have to have something in all fields? Also, When I click on the email link it doesn't bring up a way to email. How can I fix this for my customers?Thanks so much for your help.
Replies
Replied 15 Oct 2006 07:48:29
15 Oct 2006 07:48:29 micah santos replied:
you basically need a form validation script.
here's how:
<%
// input from users
Dim gl_name,gl_loc,frm_Valid
gl_name = Request.Form("name"
gl_loc = Request.Form("location"
If strLen(gl_name) = 0 Then
frm_Valid = false
End If
If strLen(gl_loc) = 0 Then
frm_Valid = true
End If
if NOT frm_Valid Then
response.write "Please fill-in all required fields."
else
response.write "All fields are valid."
end if
%>
about the email link:
<%
user_name = "John"
user_email = " "
// display email using mailto:
// format: <a href='mailto: '>Name</a>
response.write "<a href='mailto:" & user_email & "'>" & user_name & "</a>"
%>
here's how:
<%
// input from users
Dim gl_name,gl_loc,frm_Valid
gl_name = Request.Form("name"
gl_loc = Request.Form("location"
If strLen(gl_name) = 0 Then
frm_Valid = false
End If
If strLen(gl_loc) = 0 Then
frm_Valid = true
End If
if NOT frm_Valid Then
response.write "Please fill-in all required fields."
else
response.write "All fields are valid."
end if
%>
about the email link:
<%
user_name = "John"
user_email = " "
// display email using mailto:
// format: <a href='mailto: '>Name</a>
response.write "<a href='mailto:" & user_email & "'>" & user_name & "</a>"
%>
Replied 15 Oct 2006 22:54:09
15 Oct 2006 22:54:09 Tina Paulus replied:
Thanks so much. I will try that as soon as I have enought time. You help is very appreciated.