Solved

Can not get textarea to clear with onclick

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

932 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

6 Experts available now in Live!

Get 1:1 Help Now