Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Can not get textarea to clear with onclick

Posted on 2010-11-08
1
Medium Priority
?
381 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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…

927 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