Forums / Setup & design / Javascript and overriede browse.tpl ..BUG ?!

Javascript and overriede browse.tpl ..BUG ?!

Author Message

Selmah Maxim

Wednesday 07 December 2005 10:35:25 am

Hi ..

AM trying to override the browse.tpl, ok ... easy to but the javascript is not working, and when i place the same code in another template work fine ... what to do ?!


{literal}
<script language="JavaScript">
var DomYes=document.getElementById?1:0;

function set_child_listbox(parentObject,childObject,childArray,spanToHide) {

	//Clear child listbox
	for(var i=childObject.length;i>0;i--) {
		childObject.options[i] = null;
	} 
	
	childObject.options[0] = new Option("Select Value","");
	var sel_index = parentObject.options[parentObject.selectedIndex].value;
	if (sel_index == "") {
		childObject.disabled = true;
	} else {
		childObject.disabled = false;
		var childIndex = 1;
		for (i = 0; i < childArray.length; i++) {
			if (childArray[i][1] == sel_index) {
				childObject.options[childIndex] = new Option(childArray[i][2], childArray[i][0]);
				childIndex++;
			}
		}
	}
	//Select first option
	childObject.selectedIndex = 0;

	//Hide dependent grid
	if (spanToHide != "") {
		if (DomYes) {
  			document.getElementById(spanToHide).style.display="none";
		} else {
			document.all[spanToHide].style.display="none";
		}
	}
}

function reload_page() {
  var sel_index = document.SelectCarCat.s_category_id.options[document.SelectCarCat.s_category_id.selectedIndex].value;
  var sel_subindex = document.SelectCarCat.SelectedNodeIDArray.options[document.SelectCarCat.SelectedNodeIDArray.selectedIndex].value;
  if (sel_subindex != "") {
	 document.location.href = document.location.pathname + "?" + "SelectedNodeIDArray=" + sel_subindex+"&s_category_id=" + sel_index;
  }
}

function disable_child_listbox(spanToHide) {
  
  //Disable second listbox 
  if (document.SelectCarCat.s_category_id.selectedIndex == "") {
     document.SelectCarCat.SelectedNodeIDArray.disabled = true;
  }	

  //Hide dependent grid 
  if (document.SelectCarCat.SelectedNodeIDArray.selectedIndex == "") {
	if (spanToHide != "") {
		if (DomYes) {
			document.getElementById(spanToHide).style.display="none";
		} else {
			document.all[spanToHide].style.display="none";
		}
	}
  }	
}

window.onload = function() {
	disable_child_listbox("Products");
}
{/literal}





{let $car_make_cats=fetch('content','list',hash(parent_node_id,84,
                                   class_filter_type,include,
                                   class_filter_array,array(22)))
								   }
var Product = new Array( 
{section loop=$car_make_cats var=Make}
	
		{let $car_made_cats=fetch('content','list',hash(parent_node_id,$Make.node_id,
                                   class_filter_type,include,
                                   class_filter_array,array(17)))
		}
			{section loop=$car_made_cats var=Made}
								new Array({$Made.node_id},{$Make.node_id},'{$Made.name}')
								{*section show=qe($Made.parent.children_count,$Made.number)*},{*/section*}
			{/section}
		{/let}  

{/section}
new Array(999,888,'xxxx')
);
{/let}


</script>

      
<form action="/car/index.php/automobile/content/action" method="post" name="SelectCarCat">

  	<div  ID="carmakediv">
              <select name="car_make" size="5" onchange="set_child_listbox(this, document.SelectCarCat.NodeID,Product,'Products');" style="position:absolute;width:136px;height:95px;top:-4px;left:-3px;">
  <option value="" selected>Select Car Make</option>
				{let $car_make_cats=fetch('content','list',hash(parent_node_id,84,
                                   class_filter_type,include,
                                   class_filter_array,array(22)))
								   }

					{section loop=$car_make_cats var=Make}
						<OPTION VALUE="{$Make.node_id}" >{$Make.name}</OPTION>
					{/section}

      </select>
  </div>
			  {/let}
			<div  ID="carmodeldiv" >
              <select name="NodeID" size="5"  style="position:absolute;width:136px;height:95px;top:-4px;left:-3px;" >
			  <OPTION VALUE="" style="background-color: red;color:#000000;">Select Car Made</OPTION>
			  </select>
  			</div>

 <div style="	padding: 55px; "></div>


<input type="hidden" name="BrowseActionName" value="{$browse.action_name}" />
<input class="button" type="submit" name="SelectButton" value="{'Select'|i18n('design/standard/content/browse')}" />
 <input class="button" type="submit" name="BrowseCancelButton" value="{'Cancel'|i18n( 'design/standard/content/browse' )}" />
</form>


This script will show the child cats when u select the main ... any hope ?!

Thanks in advance.

Selmah Maxim

Wednesday 07 December 2005 12:14:24 pm

I know why is not working .. its give me back undefined object about the snd child select .. buts its there ... and with normal html work fine .,... I cann`t think why ... spent 3 hours to slove it ... and the problem my client asking it like this :(

Selmah Maxim

Wednesday 07 December 2005 12:56:09 pm

OK ... I found it ... 2 form ... same name ! :)

eZ debug

Timing: Jan 18 2025 22:12:12
Script start
Timing: Jan 18 2025 22:12:12
Module start 'content'
Timing: Jan 18 2025 22:12:13
Module end 'content'
Timing: Jan 18 2025 22:12:13
Script end

Main resources:

Total runtime0.9498 sec
Peak memory usage4,096.0000 KB
Database Queries192

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0089 591.4531180.8281
Module start 'content' 0.00890.7903 772.2813456.2969
Module end 'content' 0.79930.1504 1,228.5781337.4688
Script end 0.9497  1,566.0469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.4295210.0002
Check MTime0.00150.1542210.0001
Mysql Total
Database connection0.00170.178410.0017
Mysqli_queries0.864491.01301920.0045
Looping result0.00180.18671900.0000
Template Total0.918396.720.4592
Template load0.00230.241320.0011
Template processing0.916096.447920.4580
Template load and register function0.00020.023910.0002
states
state_id_array0.00070.074910.0007
state_identifier_array0.00180.188520.0009
Override
Cache load0.00180.1928120.0002
Sytem overhead
Fetch class attribute can translate value0.00130.138920.0007
Fetch class attribute name0.00090.098630.0003
XML
Image XML parsing0.00050.053220.0003
class_abstraction
Instantiating content class attribute0.00000.000830.0000
General
dbfile0.01171.2341210.0006
String conversion0.00000.000830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs