HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
forget the input text after error massage
Post new topic   Reply to topic    HTML Help Forum Index -> ASP
View previous topic :: View next topic  
Author Message
sanjeev



Joined: 23 Nov 2007
Posts: 31

PostPosted: Tue Nov 27, 2007 12:39 am     forget the input text after error massage Reply with quote

how can retrive the input text after submit button pressed and report a error message. i wants to post topic and if any error message is occured then retrive the inputed text but it forget its
Code:

<%@ Language=VBScript%>
<%Option Explicit
If Request.Cookies("userid") = "" Then
  Response.Redirect "login.asp"
Else
Dim R, page,vopenflg
Dim vlaunchby,i,vcount
Dim vtopid,vnoofreply
Dim vtopstatus
Dim vtopsub
Dim vemail
Dim vmsg
Dim errorMsg
Dim conn
Set conn = Server.Createobject("ADODB.Connection")
conn.Open "DSN=ORACLE; User ID = STARTER; Password = STARTER"
Set R = Server.CreateObject("ADODB.Recordset")
  R.Open "Select top_id from topmaster  order by top_id ", conn, adOpenStatic, adLockOptimistic, adCmdText
    If R.Recordcount > 0 Then
    R.Movelast
    vtopid = R("top_id")
    vtopid = CInt(vtopid) + 1
  Else
    vtopid = 1
  End if
   R.Close
   vopenflg=Response.Write("N")
   vnoofreply=Cint(vnoofreply)
   vnoofreply=0
 If Not IsEmpty(Request.Form("submit")) then
   vtopstatus = Request.Form("vtopstatus")
   vtopsub = Request.Form("vtopsub")
   vopenflg=request.form("vopenflg")
   vmsg = Request.Form("vmsg")
   vtopsub = trim(vtopsub)
   vopenflg=trim(vopenflg)
   vnoofreply=trim(vnoofreply)
   vmsg = trim(vmsg)
   vtopstatus = trim(vtopstatus)
 If len(errorMsg) = 0 Then
    If len(vtopsub) = 0 Then
      errorMsg = "Please Enter Topic Subject "
    End If
  End if
   If len(errorMsg) = 0 Then
     If len(vmsg) = 0 Then
       errorMsg = "* Your must enter your message"
    end if 
     if len(vmsg) > 500 Then
       errorMsg = "**  More than 500 characters...now limiting to 500  "
     End If
   End If
  If len(errorMsg) = 0 Then
    conn.Close
    conn.Mode = adModeReadWrite
    conn.Open
    R.Open "Select * from topmaster", conn, adOpenStatic, adLockOptimistic, adCmdText
    R.Addnew
   R("top_id") = vtopid
    R("top_sub") = vtopsub
    R("topic_status") = vtopstatus
    R("launch_by") = request.cookies("userid")
    R("launch_dt") = Cdate(date())
   R("open_flg")= request.form(vopenflg)
   R("no_of_reply")=vnoofreply
    R("msg") = vmsg
    R.UPdate
    R.Close
   Response.Redirect "message.asp"
  End If
  END IF

End If
%>
<html>
<head>
<title>Voice Of Baraunians</title>
<!--#include file="front1.inc"-->
</head>
<body>
<div style="Position:Absolute; top:100; left:15; width:980; height:472; background-color:#B4DEFE">
  <center>
    <b><BR>
      <h2>POST YOUR MESSAGE</h2>
    </b>
  </center>
  <hr>
  <p>
  <form method="POST" action="newtopic.asp">
    <%If len(errorMsg) > 0 Then
       Response.Write "<b><p><font  color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & errorMsg & "</font></p></b>"
    End If
     %>
    <table width=820>
      <tr>
       <table align="center">
         <tr>
          <td align="right"><font face="arial" size=2><b>Topic Subject : </b></font></td>
          <td align='left'><input type="text" style="width:90%" name="vtopsub" maxlength="120"></td>
       </tr>
   <tr><td></td><td> ( Please Post Message Within 500 Character )</td><td></td></tr>
   <tr>
   <td align="right"><font face="arial" size=2><b>Message : </b></font></td>
    <td align='left'><Textarea name="vmsg" cols="50" rows="10"></textarea></td>
   </tr>
  </table>
      </tr>
      <tr>
        <table align="center" >
          <tr>
            <td align="center"><input type="Submit" name="submit" value="Save">
                               <input type="reset" name="reset" value="Reset">
            </td>
         </tr>
       </table>
      </tr>
     </table>
     <script language = "javascript">
         function goback()
           {
             window.location = "brvoice.asp"
           }
      </script>
    </form>
   </p>
  </div>
 </body>
</html>
sanjeev



Joined: 23 Nov 2007
Posts: 31

PostPosted: Sun Dec 16, 2007 8:01 pm     Reply with quote

it retrive the value of tax area and doesn't go balnk
Code:

<textarea name="vmsg" cols="50" rows="10" onKeyPress="return imposeMaxLength(this,500)"><%=vmsg%> </textarea>
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> ASP All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial