Solved

Can not get textarea to clear with onclick

Posted on 2010-11-08
1
377 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

Industry Leaders: 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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

679 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