Solved

How to remove text in textbox after submit form?

Posted on 2008-10-29
3
798 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a‚Ķ
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall‚Ķ
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now