Solved

ASP Button to clear text

Posted on 2016-11-24
4
53 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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/…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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