Solved

How to remove text in textbox after submit form?

Posted on 2008-10-29
3
802 Views
Last Modified: 2008-10-30
Hi

I have a form with several textbox and submit buttons. The text will be input to DB after pressing the submit button. However, the text is left in the textbox after pressing the submit button.

I want to clear the text in the textbox everytime the submit button was clicked.

How can I do that? with js?
0
Comment
Question by:techques
  • 2
3 Comments
 
LVL 2

Expert Comment

by:smokingspaceman
ID: 22837724
Well you can use server-side and client-side both.

If you want to clear the text from server-side add something like
textbox.text = "" 

If you want to clear the text using client-side java script add an event handler to onClientClick event, that goes through all the textboxes and clear their values.
0
 

Author Comment

by:techques
ID: 22837958
can you show me the code to do client-side java script add an event handler to onClientClick event?
0
 
LVL 2

Accepted Solution

by:
smokingspaceman earned 50 total points
ID: 22838004
<asp:Button ID="Button1" onClientClick="clearText()" runat="server" Text="Button" />
           <script type="text/javascript">
           function clearText(){
           document.getElementById('text1').value = '';
           }
          </script>
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question