?
Solved

How to remove text in textbox after submit form?

Posted on 2008-10-29
3
Medium Priority
?
812 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

719 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