Solved

ASP Button to clear text

Posted on 2016-11-24
4
67 Views
Last Modified: 2016-11-24
I want to clear a text field at the press of a button, I have this: -
function BlankText() {
    document.getElementById("DispatchNote").reset();
}

Open in new window


Then this: -
<td class="auto-style1"><input name="Clear" type="submit" value="Clear Input" onclick="return BlankText()"/></td>

Open in new window


This is the text box: -
<td><input name="DispatchNote" id="DispatchNote" type="text" maxlength="20" value="<%=Request.Form("DispatchNote")%>"/></td>

Open in new window


Can anyone tell me why it is not working?
0
Comment
Question by:HKFuey
[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
  • 2
4 Comments
 

Accepted Solution

by:
HKFuey earned 0 total points
ID: 41900370
Just needed: -
function BlankText() {
    document.getElementById("DispatchNote").value = "";
}
0
 

Author Closing Comment

by:HKFuey
ID: 41900371
Works
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 41900375
I am not on my development computer, so I could not debug your provided code.
However, you can give the following code a shot.

<script>
function ClearFields() {

     textfield1.value = "";
}
</script>

<button type="button" onclick="ClearFields();">Clear</button>

<input type="text" value="A new value" id="textfield1">

Open in new window


HTH Carrzkiss
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 41900376
A little late, glad someone was able to asist.
0

Featured Post

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
rebind a grid after user clicks on node in treeview 1 48
Query still returning duplicates 5 50
Asp response.write to clients 6 33
VB script help 23 30
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

756 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