Solved

ASP Button to clear text

Posted on 2016-11-24
4
18 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
  • 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 30

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 30

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

19 Experts available now in Live!

Get 1:1 Help Now