1 Replies - 1927 Views - Last Post: 20 January 2010 - 03:19 AM

#1 richdynamix  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-January 10

how to add text to div if a hidden fiield value changes

Posted 20 January 2010 - 02:42 AM

I am currently working on a small Ajax image upload script using some clever iframes, php and a lytebox to create a seamless application. a small link on a page starts my lytebox that essentially opens a new page inside this. this page takes a file upload and using an iframe posts to a php script that will validate the file and upload to the server, the location of this file is then posted back to the iframe for viewing. Once this completes I have a cropping tool available for users to make final adjustments to their image before saving this and sending the new cropped image location to a value of a hidden text box. Once the user is happy with this they can click close to return to the parent page, upon doing this the value of the hidden filed is passed back to parent page and saved into another hidden filed to use. ( To clarify, i use hidden values as the parent page is the actual upload script. My lytebox version was created to allow usability for users to re-size and crop their image before upload, all this happens in the lytebox to appear like its just a cropping tool.) Its at this point I am having some difficulty. I want to alert the user that the upload has been successful and all that is required is the user to hit save. This was ultimately save the finished image with all the users date in the database. I thought I could use an onchange event to trigger a function that would insert text into a div but this wont work.

My code for the parent page and the hidden field is:-

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>ajax2</title>
		<!--<link rel="stylesheet" type="text/css" href="misc/styles.css" media="screen" />-->
		
		<!-- Lytebox Includes //-->
		<script type="text/javascript" src="lytebox.js"></script>
		<link rel="stylesheet" type="text/css" href="lytebox.css" media="screen" />
		<!-- Lytebox Includes //-->

		<script language="javascript">
			function hello(string){
		   var name=string
		   document.getElementById('CroppedImage').value=name;
		 }
		 
		 function enableField()
		{
			document.fileupload.crop1.disabled=false;
		}
		
		function addInput() 
		{
			document.getElementById('text').innerHTML += "<br />Image uploaded!.";
		}
		
		
		</script>
		
	</head>
	
	<body>

	<br />
	<br />
	<a href="index.php" rel="lyteframe" title="" rev="width: 1100px; height: 600px; scrolling: auto;">Upload Image!</a>
	<br />
	<br />
	<input type="hidden" name="product_full_image" id="CroppedImage" value="" onchange="addInput()" />

	<div id="text">

	</div>

	</body>
</html>





any help would be much appreciated.

Thank you
Steven.

Is This A Good Question/Topic? 0
  • +

Replies To: how to add text to div if a hidden fiield value changes

#2 richdynamix  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-January 10

Re: how to add text to div if a hidden fiield value changes

Posted 20 January 2010 - 03:19 AM

Its ok guys, figured out a work around.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1