Solved

Can not get textarea to clear with onclick

Posted on 2010-11-08
1
374 Views
Last Modified: 2012-06-22
I am using the script below to submit information to the database. I am trying to clear the textarea as well as the file input with the onclick event as I want to keep the other hidden field value. For some reason it will not clear at all and I am not sure why..Any help would be greatly appreciated..Thanks
<fieldset>

						<legend>Add Information</legend>

						

						<form action="scripts/ajaxupload1.php" method="post" name="standard_use" id="standard_use" enctype="multipart/form-data">

                         <p>Description:<br /><textarea name="description" id="description" rows="8" cols="80" /></textarea>

                         <script type="text/javascript">

			//<![CDATA[



				CKEDITOR.replace( 'description',

					{

						fullPage : true

					});



			//]]>

			</script>

                       <input type="hidden" name="entryid" value="<?php echo ''.$_GET['id'].'' ?>" /></p>

							<p><input type="file" name="filename" id="filename" /></p>

							<button onclick="ajaxUpload(this.form,'scripts/ajaxupload1.php?filename=filename&amp;maxSize=9999999999&amp;maxW=1000&amp;fullPath=http://www.tristatefoliagewonder.com/new_site/uploads/&amp;relPath=../uploads/&amp;colorR=255&amp;colorG=255&amp;colorB=255&amp;maxH=1000','upload_area','File Uploading Please Wait...&lt;br /&gt;&lt;img src=\'images/loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' /&gt;','&lt;img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /&gt; Error in Upload, check settings and path info in source code.');document.standard_use.description.value='';return false; ">Upload Image</button>

						</form>

					</fieldset>

Open in new window

0
Comment
Question by:brad0525
1 Comment
 
LVL 14

Accepted Solution

by:
sam2912 earned 500 total points
ID: 34084630
Cleaned up your HTML. See if it is working. You may not be able to clear the file field due to security issues.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
//<![CDATA[
function doAJAXUpload() {
	ajaxUpload(document.standard_use, 'scripts/ajaxupload1.php?filename=filename&amp;maxSize=9999999999&amp;maxW=1000&amp;fullPath=http://www.tristatefoliagewonder.com/new_site/uploads/&amp;relPath=../uploads/&amp;colorR=255&amp;colorG=255&amp;colorB=255&amp;maxH=1000', 'upload_area', 'File Uploading Please Wait...&lt;br /&gt;&lt;img src=\'images/loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' /&gt;', '&lt;img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /&gt; Error in Upload, check settings and path info in source code.');
	document.standard_use.description.value = '';
	document.standard_use.filename.value = '';
}
//]]>
</script>
</head>
<body>
<fieldset>
   <legend>Add Information</legend>
   <form action="scripts/ajaxupload1.php" method="post" name="standard_use" id="standard_use" enctype="multipart/form-data">
      <p>Description:<br />
         <textarea name="description" id="description" rows="8" cols="80"></textarea>
         <script type="text/javascript">
			//<![CDATA[
				CKEDITOR.replace( 'description', { fullPage : true });
			//]]>
			</script>
         <input type="hidden" name="entryid" value="<?php echo ''.$_GET['id'].'' ?>" />
      </p>
      <p>
         <input type="file" name="filename" id="filename" />
      </p>
      <input type="button" value="Upload Image" onclick="doAJAXUpload();"  />
   </form>
</fieldset>
</body>
</html>

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 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

13 Experts available now in Live!

Get 1:1 Help Now