Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to remove text in textbox after submit form?

Posted on 2008-10-29
3
Medium Priority
?
817 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

876 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