Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Entry 2

Status
Not open for further replies.

Smitty020

MIS
Jun 1, 2001
152
US
I want to set my forms to data entry! I'm new to ASP! Can someone help me out with the code so that when I sumbit a form, all of the text boxes become blank again!

Thanx in advance!

Smitty
 
It depends on what your page looks like.

This is how i normally do this kind of thing:

Code:
<%@LANGUAGE = VBSCRIPT %>
<%
'//Did the user submit the form?
IF Request.Form(&quot;Submit&quot;) = &quot;Submit&quot; Then
  '//Yes, the submit button was clicked.
  '//Submit will be equal to the button's value
  '//If the button said &quot;OK&quot;, then
  '//Request.Form(&quot;Submit&quot;) would equal &quot;OK&quot;
  '
  '//Save info to the database.
  '
  Response.Redirect &quot;ThisPage.asp&quot;
  '
  '//Redirect to this page again.
  '//This time submit will be &quot;&quot;
  '//so this part will be skipped
Else '//Submit = &quot;&quot;
  '//Draw the whole form here.
  <FORM method=post action='ThisPage.asp'>
  '
  '//Build form here
  '
  </FORM>
End IF
%>

This is what happens. The user fills in the form, and when he submits, the info is saved, and the form is loaded again.
 
It's not ASP you need, it's javascript:
Code:
<script language=javascript>
  function clearForm(){
    var i;
    for (i = 0; i < document.formName.length; i++){
      document.formName.elements[i].value = '';
    }
  }
</script>

<body onLoad=&quot;clearForm();&quot;>
That may need to be modified to account for other form elements that might not be text boxes, but you get the idea, yes?

:)
Paul Prewett
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top