Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2008
    Posts
    36
    Thanks
    4
    Thanked 0 Times in 0 Posts

    jQuery, PHP, javascript Help please

    Hey i was just wondering why i keep getting a problem with Uncaught TypeError: Object [object Object] has no method 'editable'.

    It only came up after i sorted Uncaught TypeError: Object [object Object] has no method 'jWindowCrop'. It was due to the placement of the scripts before - although im not sure if thats the problem as they look neat now and jquery is before all.

    Also i was wondering about onsubmit="return checkCoords();" as that was also appearing that checkCoords() does not exist yet it used to work. I was using the jWindowCrop v1.0.0 script.

    Thanks
    Lewis

    index.php
    Code:
    <!DOCTYPE html>
    <head>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta charset="windows-1252">
    
    <!-- Javascript -->
    <script type="text/javascript" src="content/javascript/jquery.js"></script>
    <script type="text/javascript" src="content/javascript/general.js"></script>
    <script type="text/javascript" src="content/javascript/hover_script.js"></script>
    <script type="text/javascript" src="content/javascript/jquery_corner.js"></script>
    <script type="text/javascript" src="content/javascript/default_text.js"></script>
    
    <!-- Stylesheets -->
    <link type="text/css" rel="stylesheet" href="content/stylesheets/general.css" media="screen">
    
    <!-- Javascript -->
    <script type="text/javascript" src="plus_cms/javascript/jeditable.js"></script>
    <script type="text/javascript" src="plus_cms/javascript/jWindowCrop.js"></script>
    <script type="text/javascript" src="plus_cms/javascript/charcounter_main.js"></script>
    <script type="text/javascript" src="plus_cms/javascript/charcounter_custom.js"></script> 
    <script type="text/javascript" src="plus_cms/javascript/bar.js"></script> <!-- Need Last -->
    
    <!-- Stylesheets -->
    <link type="text/css" rel="stylesheet" href="plus_cms/stylesheets/bar.css" media="screen">
    
    <title>Product Profile</title>
    </head>
    <body>
    <!-- Page Head -->
    <div id="push_page"></div>
    
    <div id="plus_bar_wrapper">
    <div id="plus_bar">
    	<a href="#" class="left"><img src="plus_cms/images/account_default.png" alt="Account"></a>
    	<h1>Admin</h1>
    	<a href="#" class="right"><img src="plus_cms/images/plus_default.png" alt="Plus"></a>
    </div>
    </div>
    <div id="page_header">
    	<div class="top">
    		<div class="page_width_center">
    			<a href="#">Contact Us</a>
    			<a href="#">About Us</a>
    			<a href="#">Home</a>
    		</div>
    	</div>
    	<div class="bottom">
    		<div class="page_width_center">
    			<a href="http://www.oliverandbird.co.uk/index2.php"><img src="content/images/logo.jpg" alt="Logo"></a>
    			
    			<form action="product_search.php" method="GET">
    			<div id="search_bar">
    				<input type="text" name="search_wine" id="search_wine">
    				<input type="submit">
    			</div>
    			</form>
    			<a id="shopping_wrapper">
    				<p>Cart (0&nbsp;Bottles) ?</p>
    				
    				<span style="font-family:arial,sans-serif; font-size:11px; color:#FF0000; float:left; margin-top:-10px; width:200px"> </span>
    			</a>
    		</div>
    	</div>
    </div>
    <div id="page_subnavigation">
    	<div class="page_width_center">
    	<div>
    		<div class="left">
    			<ul><a href="product_selection.php?country=1&amp;type=all&amp;sort=product_name&amp;dir=asc"><li class="active" style="text-transform:capitalize;">france</li></a><a href="product_selection.php?country=2&amp;type=all&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">italy</li></a><a href="product_selection.php?country=3&amp;type=all&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">spain</li></a><a href="product_selection.php?country=4&amp;type=all&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">portugal</li></a><a href="product_selection.php?country=5&amp;type=all&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">austria</li></a><a href="product_selection.php?country=6&amp;type=all&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">argentina</li></a><a href="product_selection.php?country=7&amp;type=all&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">south africa</li></a><a href="product_selection.php?country=8&amp;type=all&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">astralia</li></a><a href="product_selection.php?country=9&amp;type=all&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">chile</li></a><a href="product_selection.php?country=10&amp;type=all&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">new zealand</li></a><li class="cancel1"><img src="plus_cms/images/cancel.png" alt="Cancel" style="margin-top:-2px" class="cancel_button" title="Remove Category"></li>
    			</ul>
    		</div>
    			
    		<div class="right">
    			<h1>Need Advice?</h1><h2><div class="edit_area1_2" id="6">019841241241</div></h2>
    		</div>
    	</div>
    	</div>
    </div>
    <div id="page_subnavigation2">
    <div class="page_width_center">
    <div>
    		<div class="left"><ul>
    		<a href="product_selection.php?country=1&amp;type=all&amp;sort=product_name&amp;dir=asc">
    		<li class="active">All</li></a><a href="product_selection.php?country=1&amp;type=11&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">red</li></a><a href="product_selection.php?country=1&amp;type=12&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">white</li></a><a href="product_selection.php?country=1&amp;type=13&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">rosé</li></a><a href="product_selection.php?country=1&amp;type=14&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">sparkling</li></a><a href="product_selection.php?country=1&amp;type=15&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">port</li></a><a href="product_selection.php?country=1&amp;type=16&amp;sort=product_name&amp;dir=asc"><li style="text-transform:capitalize;">other</li></a><li class="cancel1"><img src="plus_cms/images/cancel.png" alt="Cancel" style="margin-top:-2px" class="cancel_button" title="Remove Subcategory"></li>
    			</ul>
    			
    			</div>			
    			<div class="right">
    				<h1 class="edit_area1_1" id="5">Build your custom crates. 12 bottles per crate.</h1>
    			</div>
    	</div>
    	</div>
    </div><!-- Page Body -->
    <div id="page_body">
    	<div class="page_width_center">		
    <div id="side_navigation2">
    			<div><a href="product_selection.php?country=1&amp;type=11&amp;sort=product_name&amp;dir=asc">Return to Wine List</a></div>
    			
    			<div class="advertising_wrapper"></div>
    		</div>
    	
    		<div id="right_side_page">
    
    	<div id="title_banner">
    		<p class="product1" id="5-product_name">marselan</p>
    	</div>
    	<div class="left">
    		<a id="profile_1" class="image_change"><img src="content/images/product_uploads/large/default.jpg" width="410px" style="margin-left:0px;" alt="Product"></a>
    	</div>
    	<div class="right">
    
    		<table cellspacing="0" cellpadding="8px" style="margin-top:5px; width:100%">
    			<tbody><tr><th>Availability</th>
    				<td style="padding:0px; margin:0px">
    					<img src="content/images/layout/cross.png" style="float:left; padding:0px; margin:0px; margin-top:10px; " alt="Cross">
    					<p style="float:left; margin:0px; padding:0px;"></p><div class="product3" style="height:16px; margin-top:6px; padding-top:10px; padding-left:30px;" id="5-stock_level">Out Of Stock</div><p></p></td>
    			</tr>
    			<tr>
    				<th>Product ID</th>
    				<td>5</td>
    			</tr>
    			<tr>
    				<th>Domaine</th>
    				<td style="text-transform:capitalize;" class="product1" id="5-domaine">Domaine Lalaurie</td>
    			</tr>
    			<tr>
    				<th>Principal Grape(s)</th>
    				<td style="text-transform:capitalize;" class="product1" id="5-dominant_grapes">Marselan</td>
    			</tr>
    			<tr>
    				<th>Origin</th>
    				<td style="text-transform:capitalize;" class="product1" id="5-origin">I.G.P Pays d'Oc</td>
    			</tr>
    			<tr>
    				<th>Colour</th>
    				<td style="text-transform:capitalize;" class="product4" id="5-colour">red</td>
    			</tr>
    			<tr>
    				<th>Vintage</th>
    				<td class="product1" id="5-vintage_year">2009</td>
    			</tr>
    			<tr>
    				<th style="color:#9E0739; border-bottom:0px;">
    					<p style="margin-top:0px;">Price</p>
    				</th>
    				<td style="color:#9E0739; border-bottom:0px; font-size:16px;">
    					<p style="float:left; margin:2px;">£</p>
    					<div style="float:left; margin:2px;" class="product5" id="5-bottle_price">12</div>
    					<p style="float:left; margin-top:2px; margin-left:0px; margin-right:0px;">.</p>
    					<div style="float:left; margin-top:2px;" class="product6" id="5-bottle_price2">12</div>
    				</td>
    			</tr>
    		</tbody></table>
    		
    		<div class="product_text"><div class="product2" id="5-product_description">weeeeeeeeeeeeeeeeeeeeeeeee</div></div></div>			
    		</div>
    	</div>
    </div>
     
    <div class="popup_bg1"></div>
    <div class="popup1">
    	<div class="status_bar"><p>Image Upload</p><a class="popup_close"></a></div>
    	<div class="popup_content_wrapper">
    		<div>
    		<iframe src="plus_cms/image_upload.php" style="width:100%; float:left; height:105px; margin-top:-10px; border:0px; border-bottom:1px solid #CCC; margin-bottom:20px;">&lt;p&gt;Your Browser Is Out-Of-Date.&lt;/p&gt;</iframe>
    
    		<iframe src="plus_cms/image_crop.php" style="width:100%; float:left; height:600px;">&lt;p&gt;Your Browser Is Out-Of-Date.&lt;/p&gt;</iframe>			
    			
    			
    		</div> 
    	</div>
    </div>
    <!-- Page Footer -->
    <div id="page_footer">
    	<div class="top">
    		<div class="page_width_center">
    			
    	
    		</div>
    	</div>
    	<div class="bottom">
    		<div class="page_width_center">
    			<p>Copyright © <a href="plus_cms/login.php">oliverandbird.co.uk</a> - All Rights Reserved. Website Designed By <a href="http://www.tomlewismedia.co.uk" target="_BLANK">Tom Lewis Media</a>. </p>
    		</div>
    	</div>
    </div>
    </body>
    </html>
    Image Upload:
    Code:
    <!DOCTYPE html>
    <head>
    	<meta http-equiv="cache-control" content="no-cache">
    	<meta http-equiv="pragma" content="no-cache">
    
    	<!-- Javascript -->
    	<script type="text/javascript" src="javascript/jquery.js"></script>
    	<script type="text/javascript" src="javascript/bar.js"></script>
    	
    	<!-- Stylesheets -->
    	<link type="text/css" rel="stylesheet" href="stylesheets/bar.css" media="screen"/>
    </head>
    
    <body>
    <div class="upload_image"><p>Upload Image</p>
    <form action="image_upload.php" method="POST">
    	<input type="file" name="photo" style="width:600px; float:left; cursor:pointer;"/>
    	<div id="submit_wrapper">
    		<input type="button" id="upload_button" name="upload_button" value="Upload Image"/>
    	</div>
    </form>
    </div>
    </body>
    Image Crop:
    Code:
    <?php
    $visited2 = $_COOKIE["image_upload"];
    
    $src1 = '../content/images/product_uploads/large/';
    $src2 = '../content/images/product_uploads/temp/';
    
    $first_image = $src1."default.jpg";
    $second_image = $src2."default.jpg";
    
      if (isset($_POST['image2'])) {
    		header("Cache-Control: no-cache, must-revalidate");
    		header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    		header("Location:image_crop.php"); 
    		
    		$targ_w = 300;
    		$targ_h = 500;
    			
    		$im = @imagecreatetruecolor($targ_w, $targ_h) or die('Cannot Initialize new GD image stream');
    		$output_file = $second_image;
    		$img_r = imagecreatefromjpeg($first_image);
    		$image = imagecopyresampled($im,$img_r,0,0,$_POST['x'],$_POST['y'],	$targ_w,$targ_h,$_POST['w'],$_POST['h']);
    		imagejpeg($im, $output_file);  
    	}
    ?>
    <!DOCTYPE html>
    <head>
    	<meta http-equiv="cache-control" content="no-cache">
    	<meta http-equiv="pragma" content="no-cache">
    	<script type="text/javascript" src="javascript/jquery.js"></script>
    	<script type="text/javascript" src="javascript/jWindowCrop.js"></script>
    	<link type="text/css" rel="stylesheet" href="stylesheets/jWindowCrop.css" media="screen"/>
    </head>
    
    <body>
    <table>
    	<tr>
    		<td>
    			<img class="crop_me2" alt="Crop Image" src="<?php echo $first_image.'?'.date('YmdHis'); ?>" />
    			<?php
    				echo '
    				<form action="'.$_SERVER["PHP_SELF"].'" method="post" onsubmit="return checkCoords();">
    					<input type="hidden" class="x" name="x"/>
    					<input type="hidden" class="y" name="y"/>
    					<input type="hidden" class="w" name="w"/>
    					<input type="hidden" class="h" name="h"/>
    				 '; 
    			?>
    		</td>
    		<td>
    			<img src="<?php echo $second_image.'?'.date('YmdHis'); ?>" style="border:2px solid #D6D6D6;" />
    		</td>
    	</tr>
    	<tr>
    		<td>
    			<input type="submit" name="image2" value="Crop Image" />
    			</form>
    		</td>
    		<td>
    			<form action="image_crop.php"><input type="submit" value="Refresh Content"/></form>
    		</td>
    	</tr>	
    </body>
    Javascript/jQuery:
    Code:
    $(document).ready(function(){
    	$('.crop_me2').jWindowCrop({
    		targetWidth: 300,
    		targetHeight: 500,
    		onChange: function(result) {
    				$('.x').val(result.cropX);
    				$('.y').val(result.cropY);
    				$('.w').val(result.cropW);
    				$('.h').val(result.cropH);
    		}
    	});
    
    	$('.edit_area1').editable('plus_cms/javascript/edit_functions/save.php', { 
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/load.php',
    			 type   : 'charcounter',
    			 submit : 'OK',
    			 onblur	: 'submit',
    			 height	: 30,
    			 charcounter : {
    				 characters : 50
    			  }
    		 });
    		
    		  $('.edit_area1_1').editable('plus_cms/javascript/edit_functions/save.php', { 
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/load.php',
    			 type   : 'charcounter',
    			 submit : 'OK',
    			 onblur	: 'submit',
    			 height	: 20,
    			 charcounter : {
    				 characters : 47
    			  }
    		 });
    		 $('.edit_area1_2').editable('plus_cms/javascript/edit_functions/save.php', { 
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/load.php',
    			 type   : 'charcounter',
    			 onblur	: 'submit',
    			 height	: 20,
    			 charcounter : {
    				 characters : 12
    			  }
    		 });
    		 $('.edit_area2').editable('plus_cms/javascript/edit_functions/save.php', { 
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/load.php',
    			 type   : 'charcounter',
    			 submit : 'OK',
    			 onblur	: 'submit',
    			 height	: 60,
    			 charcounter : {
    				 characters : 100
    			  }
    		 });
    		 $('.edit_area3').editable('plus_cms/javascript/edit_functions/save.php', { 
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/load.php',
    			 type   : 'charcounter',
    			 submit : 'OK',
    			 onblur	: 'submit',
    			 height	: 60,
    			 charcounter : {
    				 characters : 200
    			  }
    		 });
    		 $('.edit_area4').editable('plus_cms/javascript/edit_functions/save.php', {
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/load.php',
    			 type   : 'charcounter',
    			 submit : 'OK',
    			 onblur	: 'submit',
    			 height	: 60,
    			 charcounter : {
    				 characters : 400
    			  }
    		 });
    		 
    		 /*************** Product_Edit **************/
    		$('.product1').editable('plus_cms/javascript/edit_functions/product_save.php', { 
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/product_load.php',
    			 type   : 'charcounter',
    			 submit : 'OK',
    			 data : 'rwaaaaaaa',
    			 onblur	: 'submit',
    			 height	: 15,
    			 charcounter : {
    				 characters : 50
    			 }
    		 });
    		 $('.product2').editable('plus_cms/javascript/edit_functions/product_save.php', { 
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/product_load.php',
    			 type   : 'charcounter',
    			 submit : 'OK',
    			 onblur	: 'submit',
    			 height	: 257,
    			 charcounter : {
    				 characters : 1000
    			 }
    		 });
    		 $('.product3').editable('plus_cms/javascript/edit_functions/dropdown_save.php', { 
    			 indicator : 'Saving...',
    			 data   : '{"1":"In Stock","0":"Out Of Stock"}',
    			 type   : 'select',
    			  callback : function(){
    				window.location.reload();
    			 }
    		 });
    		$('.product4').editable('plus_cms/javascript/edit_functions/dropdown_save.php', { 
    			 indicator : 'Saving...',
    			 loadurl : 'plus_cms/javascript/edit_functions/json.php',
    			 type   : 'select',
    			 callback : function(){
    				window.location.reload();
    			 }
    		 }); 
    		 $('.product5').editable('plus_cms/javascript/edit_functions/product_save.php', { 
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/product_load.php',
    			 type   : 'textarea',
    			 onblur	: 'submit',
    			 height	: 10
    		 });
    		$('.product6').editable('plus_cms/javascript/edit_functions/product_save.php', { 
    			 indicator : 'Saving...',
    			 loadurl: 'plus_cms/javascript/edit_functions/product_load.php',
    			 type   : 'textarea',
    			 onblur	: 'submit',
    			 height	: 10,
    			 style	: 'border:1px solid 900',
    			 callback : function(){
    				window.location.reload();
    			 }
    		 });
    		
    
    	$('div#plus_bar > a.left > img').hover(function(){
    		$(this).attr('src','plus_cms/images/account_active.png');
    	},function(){
    		$(this).attr('src','plus_cms/images/account_default.png');
    	});
    	
    	$('div#plus_bar > a.right > img').hover(function(){
    		$(this).attr('src','plus_cms/images/plus_active.png');
    	},function(){
    		$(this).attr('src','plus_cms/images/plus_default.png');
    	});
    
    		$('.image_change').hover(function(){
    			$(this).append('<div class="image_change_hover"></div><div class="image_change_overlay"><p>Change Image</p></div>');
    			$('.image_change_hover').fadeIn(300);
    			$('.image_change_overlay').fadeIn(300);
    		},
    		function(){
    			$(this).children('.image_change_hover').fadeOut(300).delay(300).queue(function() { $(this).remove(); });
    			$(this).children('.image_change_overlay').fadeOut(300).delay(300).queue(function() { $(this).remove(); });
    		});
    		
    	$('.image_change').click(function(){
    		$('.popup_bg').fadeIn(300);
    		$('#image_upload_popup').fadeIn(300);
    	});
    	$('.add_product_button').click(function(){
    		$('.popup_bg').fadeIn(300);
    		$('#add_product_popup').fadeIn(300);
    	});
    	
    	$('.popup_close').click(function(){
    		$('.popup_bg').fadeOut(300);
    		$('.popup1').fadeOut(300);
    	});
    	$('.popup_bg').click(function(){
    		$('.popup_bg').fadeOut(300);
    		$('.popup1').fadeOut(300);
    	});
    	
    	
    	var dropdown_state = 0;
    	$('#plus_bar > .left').click(function(){
    		if(dropdown_state == 0){
    			$('.dropdown1').show();
    			dropdown_state = 1;
    		} else {
    			$('.dropdown1').hide();
    			dropdown_state = 0;
    		}
    	});
    	$('.dropdown1 > ul > a > li').click(function(){
    		$('.dropdown1').hide();
    	});
    	
    	var dropdown_state2 = 0;
    	$('#plus_bar > .right').click(function(){
    		if(dropdown_state2 == 0){
    			$('.dropdown2').show();
    			dropdown_state2 = 1;
    		} else {
    			$('.dropdown2').hide();
    			dropdown_state2 = 0;
    		}
    	});
    	$('.dropdown2 > ul > a > li').click(function(){
    		$('.dropdown2').hide();
    	});
    	
    	$(document).mouseup(function (e){
    		var container = $('.dropdown1');
    		var container2 = $('.dropdown2');
    		
    		if (container.has(e.target).length === 0)
    		{
    			$(container).hide();
    		}
    		if (container2.has(e.target).length === 0)
    		{
    			$(container2).hide();
    		}
    	}); 
    	
    });

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,694
    Thanks
    25
    Thanked 657 Times in 656 Posts
    How do these file relate to each other? I haven't a clue. A link to a site would be a lot better.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •