Solved

How to remove text in textbox after submit form?

Posted on 2008-10-29
3
800 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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