| 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. |