Jump to content

Only Alphabatic Data Entered In Text Field


laado
 Share

Recommended Posts

its the code

<%option explicit%><!-- #INCLUDE FILE="login-check.asp" --><!-- #INCLUDE FILE="settings.asp" --><%id = request("id")if id < 1 then	response.write (errormsg)	response.endend ifSet dConn = Server.CreateObject("ADODB.Connection")dConn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & database_path'========================================if request.form("ispostback") = 1 then	set updateRS = Server.CreateObject("ADODB.RecordSet")	updateSQL = "SELECT * from tblnews where ID = " & ID & ";"	updateRS.Open updateSQL,dConn, 1,3		urecordcount = updateRS.recordcount		if urecordcount <> 1 then			updateRS.Close			Set updateRS = Nothing			response.redirect("default.asp?norecord")		end if	updateRS("newsdate") = checkdate(request.form("newsdate"))	updateRS("expire") = checkdate(request.form("expire"))	updateRS("newstitle") = Presubmit2(request.form("newstitle"))	updateRS("newsbody") = Presubmit2(request.form("newsbody"))	updateRS("active") = request.form("active")	updateRS.update	updateRS.Close	set updateRS = Nothing	message = "<p><font color='#FF0000'>Update Successful</font></p>"end if'========================================strSQL = "SELECT expire, id, newsdate, newstitle, newsbody, active from tblnews where ID = " & ID & ";"Set newsRS = Server.CreateObject("ADODB.recordset")newsRS.Open strSQL, dConn, 1, 3		recordcount = newsrs.recordcount		if recordcount < 1 then			newsRS.close			set newsRS = nothing			dConn.close			set dConn = nothing			response.write (errormsg)			Response.end		end ifFor fnum = 0 To newsRS.Fields.Count-1	execute(newsRS.Fields(fnum).Name & " = newsRS(" & CHR(34) & newsRS.Fields(fnum).Name & CHR(34) & ")")Nextif newsbody <> "" then	newsbody = undo(newsbody)end if%><!-- #INCLUDE FILE="admin-menu.asp" --><title>Edit News</title><h3><%=newstitle%></h3><%=message%><form action="edit-news.asp" method="post" name="frm" id="frm"><table border=2 bordercolor="#CCCCFF" CELLSPACING=0 CELLPADDING=4><tr>	<td>News Title</td>	<td><input type="text" name="newstitle" value="<%=newstitle%>" size="50" class="cssborder"></td></tr><tr>	<td>News Date</td>	<td><input type="text" name="newsdate" value="<%=newsdate%>" size="12" class="cssborder"></td></tr><tr>	<td>News Expire Date</td>	<td><input type="text" name="expire" value="<%=expire%>" size="12" class="cssborder"></td></tr><tr>	<td valign="top">News Text</td>	<td><textarea cols="50" rows="8" name="newsbody" class="cssborder"><%=newsbody%></textarea></td></tr><tr>	<td valign="top">Active</td>	<td>	<% if active = "1" then%>	<input type="checkbox" name="active" value="1" checked>	<% else %>	<input type="checkbox" name="active" value="1">	<% end if %>	</td></tr><tr>	<td colspan="2">	<input type="hidden" name="id" value="<%=id%>">	<input type="hidden" name="ispostback" value="1">	<input type="submit" value="update" class="cssborder"> <input type="reset" class="cssborder">	</td></tr></table></form><p><a href="edit-news.asp?id=<%=id%>">reload</a></p></body></html>

wht will be the code for validation check and where to put?

The code will be the code that you write, in order to help you I'll tell you to look into using regular expressions for validation. How the error message gets displayed depends on how your application is set up.
Link to comment
Share on other sites

You're going to write the code, I'm not going to write it for you. Look up regular expressions, that's what you need to use to check for things like this:http://www.google.com/search?client=opera&...-8&oe=utf-8That code already has a section that's processing the form, so it would make sense to add the new code to that section.

Link to comment
Share on other sites

i cant understand please explain.give me example please

You're going to write the code, I'm not going to write it for you. Look up regular expressions, that's what you need to use to check for things like this:http://www.google.com/search?client=opera&...-8&oe=utf-8That code already has a section that's processing the form, so it would make sense to add the new code to that section.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...