function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jaicen83Jaicen83 

Java is not loading on Visualforce page as of Winter 16

Here is my visual force page with the include script on top and the script at the bottom of the page.
 
<apex:page tabstyle="Quote" showHeader="true" standardController="Quote" extensions="ManageQuoteProductController" id="ManageQuoteProduct">

<script src="sorttable.js"></script>
    <apex:includeScript value="{!$Resource.DependentPicklist}"  />
    <apex:includeScript value="{!$Resource.jquery180}" />
  
    <apex:pageBlock id="ProductLineBlock" title="Manage Product">
    <apex:form >
     <p align="center">
        <apex:commandButton value="Close" action="{!cancelManageProduct}" />
     </p>
     </apex:form>
     <apex:pageblockSection ></apex:pageblockSection>
     <apex:pageMessages id="msgs" />
     

        <!-- Product Search Result section -->
        <apex:form >
        <apex:pageBlockSection title="Selected Products" columns="1" collapsible="false">
            <apex:pageBlockTable value="{!Qlis}" var="Qli">
                <apex:column style="white-space:nowrap">
                    <apex:facet name="header">Actions</apex:facet>
                    <apex:commandLink action="{!processQLI}" value="Edit" id="editQLILink" >
                        <apex:param value="{!Qli.Id}" name="QliId" />
                        <apex:param value="edit" name="QliAction" />
                    </apex:commandLink>
                    &nbsp; | &nbsp;
                    <apex:commandLink action="{!processQLI}" value="Delete" id="deleteQLILink" >
                        <apex:param value="{!Qli.Id}" name="QliId" />
                        <apex:param value="delete" name="QliAction" />
                    </apex:commandLink>
                </apex:column>
                <apex:column ><apex:facet name="header">Model</apex:facet>{!Qli.PricebookEntry.Product2.Model__c}</apex:column>
                <apex:column ><apex:facet name="header">Product Name</apex:facet>{!Qli.PricebookEntry.Product2.Name}</apex:column>
                <apex:column ><apex:facet name="header">Product Description</apex:facet>{!Qli.PricebookEntry.Product2.Description}</apex:column>
                <apex:column ><apex:facet name="header">Product Line</apex:facet>{!Qli.PricebookEntry.Product2.Family}</apex:column>
                <apex:column style="text-align: right">
                    <apex:facet name="header">Quantity</apex:facet>
                    <apex:outputText value="{0, number, 0}"><apex:param value="{!Qli.Quantity}"/></apex:outputText>
                </apex:column>
                <apex:column style="text-align: right">
                    <apex:facet name="header">Unit Price</apex:facet>
                    <apex:outputText value="{0, number, 0.00}"><apex:param value="{!Qli.UnitPrice}"/></apex:outputText>
                </apex:column>
                <apex:column style="text-align: right">
                    <apex:facet name="header">Total Price</apex:facet>
                    <apex:outputText value="{0, number, 0.00}"><apex:param value="{!Qli.TotalPrice}"/></apex:outputText>
                </apex:column>
            </apex:pageBlockTable>
            <apex:outputPanel rendered="{!IF(IsNull(Qlis),true,false)}"><br/><br/><b>No Records found</b></apex:outputPanel>
        </apex:pageBlockSection>
        </apex:form>

        
        <!-- Select Product Line section -->
        <apex:form >
        <apex:actionFunction name="ShowProductSearch" action="{!ShowProductSearch}"  />
        <apex:pageBlockSection title="Product Information" columns="1" collapsible="false">
            <apex:pageblocksectionItem >
                <apex:outputlabel value="Select Product Line" for="productLine" />
                <apex:selectList value="{!prod.Family}" size="1" id="productLine">
                    <apex:selectOptions value="{!ProductLineList}"/>
                    <apex:actionSupport event="onchange" action="{!ShowProductSearch}" />
                </apex:selectList>
                <!-- apex_inputField id="productLine" value="{!prod.Family}" onchange="ShowProductSearch()" -->
            </apex:pageblocksectionItem>
        </apex:pageBlockSection>
        </apex:form>
        
        <!-- CONTAINER Search block -->
        <apex:form id="containerSearchForm">
            <apex:pageBlockSection title="Container Information" columns="1" collapsible="false" rendered="{!showContainer}">
            <apex:inputText value="{!prod.Product_Group}" styleClass="selectProductGroupHidden" style="display:none" />
            <apex:panelGrid columns="7" id="containerSearch" border="0">
                <apex:outputText value="State"      id="containerStateHeader" />
                <apex:outputText value="Product Group" id="containerProductGroupHeader"/>
                <apex:outputText value="Model"      id="containerModelHeader"/>
                <apex:outputText value="Style"      id="containerStyleHeader" />
                <apex:outputText value="Size (Yds)" id="containerSizeYdsHeader"/>
                <apex:outputText value="Description" id="containerDescriptionHeader" />
                <apex:outputText value=" "          id="containerSearchBtnHeader" />
                <apex:selectList value="{!prod.State}" size="1" id="containerState">
                    <apex:selectOptions value="{!stateOptions}"/>
                </apex:selectList>
                <select size="1" id="containerProductGroup" class="selectProductGroup">
                    <option value="">--None--</option>
                </select>
                <apex:inputText value="{!prod.Description}" id="containerDescription"  />
                <apex:inputText value="{!prod.Model}" id="containerModel" />
                <apex:inputText value="{!prod.Container_Style}" id="containerStyle"  />
                <apex:inputText value="{!prod.Container_Size}" id="containerSizeYds" />
                <apex:commandButton value="Search" id="cmdSearch" action="{!searchProduct}" />
            </apex:panelGrid>
        </apex:pageBlockSection>
        </apex:form>
        
        <!-- COMPACTION Search block -->
        <apex:form id="compactionSearchForm">
        <apex:pageBlockSection title="Compaction Information" columns="1" collapsible="false" rendered="{!showCompaction}">
            <apex:inputText value="{!prod.Product_Group}" styleClass="selectProductGroupHidden" style="display:none" />
            <apex:panelGrid columns="5" id="compactionSearch" border="0">
                <apex:outputText value="Region"      id="compactionRegionHeader"/>
                <apex:outputText value="Product Group"      id="compactionProductGroupHeader"/>
                <apex:outputText value="Model"      id="compactionModelHeader"/>
                <apex:outputText value="Description" id="compactionDescriptionHeader" />
                <apex:outputText value=" "          id="compactionSearchBtnHeader" />
                <!-- apex_inputField value="{!prod.Region__c}" id="compactionRegion" />
                <apex_inputField value="{!prod.Product_Group__c}" id="compactionProductGroup" -->
                <apex:selectList value="{!prod.Region}" size="1" id="compactionRegion">
                    <apex:selectOptions value="{!regionOptions}"/>
                </apex:selectList>
                <select size="1" id="compactionProductGroup" class="selectProductGroup">
                    <option value="">--None--</option>
                </select>
                <apex:inputText value="{!prod.Model}" id="compactionModel" />
                <apex:inputText value="{!prod.Description}" id="compactionDescription" />
                <apex:commandButton value="Search" action="{!searchProduct}" />
                <apex:outputText value="Opening Length" id="compactionOpeningLengthHeader"/>
                <apex:outputText value="Opening Width"      id="compactionOpeningWidthHeader" />
                <apex:outputText value="Maximum Force" id="compactionMaxForceHeader" />
                <apex:outputText value="Normal Force" id="compactionNormalForceHeader" />
                <apex:outputText value=" "           />
                
                <apex:inputText value="{!prod.Compactor_Opening_Length}" id="compactionOpeningLength" />
                <apex:inputText value="{!prod.Compactor_Opening_Width}" id="compactionOpeningWidth" />
                <apex:inputText value="{!prod.Compactor_Max_Force}" id="compactionMaxForce" />
                <apex:inputText value="{!prod.Compactor_Normal_Force}" id="compactionNormalForce" />
                <apex:outputText value=" "           />
            </apex:panelGrid>
        </apex:pageBlockSection>
        </apex:form>

        <!-- TARP Search block -->
        <apex:form id="tarpsSearchForm">
        <apex:pageBlockSection title="Tarps Information" columns="1" collapsible="false" rendered="{!showTarp}">
            <apex:inputText value="{!prod.Product_Group}" styleClass="selectProductGroupHidden" style="display:none" />
            <apex:panelGrid columns="5" id="tarpsSearch" border="0">
                <apex:outputText value="Brand"      id="tarpBrandHeader"/>
                <apex:outputText value="Product Group"    id="tarpProductGroupHeader"/>
                <apex:outputText value="Model"      id="tarpModelHeader"/>
                <apex:outputText value="Keyword"    id="tarpKeywordHeader"/>
                <apex:outputText value=" "          id="tarpSearchBtnHeader" />
                <!-- apex_inputField value="{!prod.Tarp_Brand__c}" id="tarpBrand" />
                <apex_inputField value="{!prod.Product_Group__c}" id="tarpProductGroup" -->
                <apex:selectList value="{!prod.Tarp_Brand}" size="1" id="tarpBrand">
                    <apex:selectOptions value="{!brandOptions}"/>
                </apex:selectList>
                <select size="1" id="tarpProductGroup" class="selectProductGroup">
                    <option value="">--None--</option>
                </select>
                <apex:inputText value="{!prod.Model}" id="tarpModel"/>
                <apex:inputText value="{!prod.Description}" id="tarpKeyword" />
                <apex:commandButton value="Search" action="{!searchProduct}" />
            </apex:panelGrid>
        </apex:pageBlockSection>
        </apex:form>

        <!-- ENV CONTAINERS Search block --> 
        <apex:form id="envContainerSearchForm">
        <apex:pageBlockSection title="Environmental Container Information" columns="1" collapsible="false" rendered="{!showEnvContainer}">
            <apex:inputText value="{!prod.Product_Group}" styleClass="selectProductGroupHidden" style="display:none" />
            <apex:panelGrid columns="7" id="envContainerSearch" border="0">
                <apex:outputText value="State"      id="envContainerStateHeader"/>
                <apex:outputText value="Product Group"  id="envContainerProductGroupHeader"/>
                <apex:outputText value="Model"      id="envContainerModelHeader"/>
                <apex:outputText value="Style"      id="envContainerStyleHeader" />
                <apex:outputText value="Size (Yds)" id="envContainerSizeYdsHeader"/>
                <apex:outputText value="Description" id="envContainerDescriptionHeader" />
                <apex:outputText value=" "          id="envContainerSearchBtnHeader" />
                <!-- apex_inputField value="{!prod.State__c}" id="envContainerState" />
                <apex_inputField value="{!prod.Product_Group__c}" id="envContainerProductGroup" -->
                <apex:selectList value="{!prod.State}" size="1" id="envContainerState">
                    <apex:selectOptions value="{!stateOptions}"/>
                </apex:selectList>
                <select size="1" id="envContainerProductGroup" class="selectProductGroup">
                    <option value="">--None--</option>
                </select>
                <apex:inputText value="{!prod.Model}" id="envContainerModel"/>
                <apex:inputText value="{!prod.Container_Style}" id="envContainerStyle"  />
                <apex:inputText value="{!prod.Container_Size}" id="envContainerSizeYds" />
                <apex:inputText value="{!prod.Description}" id="envContainerDescription"  />
                <apex:commandButton value="Search" action="{!searchProduct}" />
            </apex:panelGrid>
        </apex:pageBlockSection>
        </apex:form>


        <!-- MOBILE Search block -->
        <apex:form >
        <apex:pageBlockSection title="Mobile Information" columns="1" collapsible="false" rendered="{!showMobile}">
            <apex:inputText value="{!prod.Product_Group}" styleClass="selectProductGroupHidden" style="display:none" />
            <apex:panelGrid columns="4" id="mobileSearch" border="0">
                <apex:outputText value="Product Group"  id="mobileProductGroupHeader" />
                <apex:outputText value="Model"      id="mobileModelHeader" />
                <apex:outputText value="Description"    id="mobileDescriptionHeader" />
                <apex:outputText value=" "          id="mobileSearchBtnHeader" />
                <!-- apex_inputField value="{!prod.Product_Group__c}" id="mobileProductGroup" -->
                <select size="1" id="mobileProductGroup" class="selectProductGroup">
                    <option value="">--None--</option>
                </select>
                <apex:inputText value="{!prod.Model}" id="mobileModel"/>
                <apex:inputText value="{!prod.Description}" id="mobileDescription" />
                <apex:commandButton value="Search" action="{!searchProduct}" />
                <apex:outputText value="Hoist Rating"   id="mobileHoistRatingHeader" />
                <apex:outputText value="Hoist Can Size"     id="mobileHoistCanSizeHeader" />
                <apex:outputText value="Hoist Rail Type"    id="mobileHoistRailTypeHeader" />
                <apex:outputText value=" " />
                <apex:inputText value="{!prod.Hoist_Rating}" id="mobileHoistRating" />
                <apex:inputText value="{!prod.Hoist_Can_Size}" id="mobileHoistCanSize" />
                <apex:inputText value="{!prod.Hoist_Rail_Type}" id="mobileHoistRailType" />
                <apex:outputText value=" " />
            </apex:panelGrid>
        </apex:pageBlockSection>
        </apex:form>


        <!-- PLASTICS Search block -->
        <apex:form >
        <apex:pageBlockSection title="Plastics Information" columns="1" collapsible="false" rendered="{!showPlastics}">
            <apex:inputText value="{!prod.Product_Group}" styleClass="selectProductGroupHidden" style="display:none" />
            <apex:panelGrid columns="5" id="plasticsSearch" border="0">
                <apex:outputText value="Product Group"      id="plasticsProductGroupHeader"/>
                <apex:outputText value="Model"      id="plasticsModelHeader"/>
                <apex:outputText value="Piece"  id="plasticsPieceHeader"/>
                <apex:outputText value="Keyword"    id="plasticsKeywordHeader"/>
                <apex:outputText value=" "          id="plasticsSearchBtnHeader" />
                <!-- apex_inputField id="plasticsProductGroup" value="{!prod.Product_Group__c}" -->
                <!-- <apex_selectList value="{!prod.Product_Group}" size="1" id="plasticsProductGroup" styleClass="selectProductGroup">
                    <apex_selectOptions value="{!productGroupOptions}"/>
                </apex_selectList> -->
                <select size="1" id="plasticsProductGroup" class="selectProductGroup">
                    <option value="">--None--</option>
                </select>
                <apex:inputText value="{!prod.Model}" id="plasticsModel"/>
                <!-- apex_inputField value="{!prod.Plastics_Piece}" id="plasticsPiece" -->
                <apex:selectList value="{!prod.Plastics_Piece}" size="1" id="plasticsPiece">
                    <apex:selectOptions value="{!plasticsPieceOptions}"/>
                </apex:selectList>
                <apex:inputText value="{!prod.Description}" id="plasticsKeyword" />
                <apex:commandButton value="Search" action="{!searchProduct}" />
            </apex:panelGrid>
        </apex:pageBlockSection>
        </apex:form>


        <!-- Product Search Result section -->
        <apex:form >
        <apex:pageBlockSection title="Product Search Results" columns="1" collapsible="false">
            <apex:pageBlockTable value="{!prodList}" var="p">
                <apex:column >
                    <apex:facet name="header">Actions</apex:facet>
                    <apex:commandLink action="{!addNewProduct}" value="Add" id="addNewProductLink" >
                        <apex:param value="{!p.product2.Id}" name="prodId" />
                    </apex:commandLink>
                </apex:column>
                <apex:column ><apex:facet name="header">Model</apex:facet>{!p.product2.Model__c}</apex:column>
                <apex:column ><apex:facet name="header">Product Name</apex:facet>{!p.product2.Name}</apex:column>
                <apex:column ><apex:facet name="header">Product Description</apex:facet>{!p.product2.Description}</apex:column>
                <apex:column ><apex:facet name="header">Product Line</apex:facet>{!p.product2.Family}</apex:column>
                <apex:column style="text-align: right">
                    <apex:facet name="header">List Price</apex:facet>
                    <apex:outputText value="{0, number, 0.00}"><apex:param value="{!P.UnitPrice}"/></apex:outputText>
                </apex:column>
            </apex:pageBlockTable>
            <apex:outputPanel rendered="{!IF(listSize==0,true,false)}"><br/><br/><b>No Records found</b></apex:outputPanel>
        </apex:pageBlockSection>
        </apex:form>
        <apex:form >
        <p align="center">
        <apex:commandButton value="Close" action="{!cancelManageProduct}" />
        </p>
        </apex:form>
        
        <apex:pageBlockSection title="Debug Window" columns="1" collapsible="false" rendered="false">
            {!debugData}
        </apex:pageBlockSection>

    </apex:pageBlock>
    loadScript()
    <script>
        var j$  = jQuery.noConflict();
        j$(document).ready(function()  {
            var OBJ_NAME = 'Product2';
            var CTRL_FIELD_NAME = 'Family';
            var DEP_FIELD_NAME = 'Product_Group__c';
            
            if ('{!prod.Family}' != '') {
                var options = getDependentOptions(OBJ_NAME, CTRL_FIELD_NAME, DEP_FIELD_NAME);
                options['{!prod.Family}'].sort();
                
                j$.each(options['{!prod.Family}'], function (i, item) {
                    j$('.selectProductGroup').append('<option value="'+item+'">'+item+'</option>');
                });
                
                j$('.selectProductGroup').change(function() {
                    j$('.selectProductGroupHidden').val(j$('.selectProductGroup').val());
                });
                
                $(".selectProductGroup option[value='']").attr("selected", "selected");
                j$('.selectProductGroup').val(j$('.selectProductGroupHidden').val());
                
            }
        });
    
    </script>
</apex:page>

 
Jaicen83Jaicen83
Code has been working for 1 full year prior to upgrade.

Now the product group will only show as none and will not give options
AndrewTaylorAndrewTaylor
Have you checked the javascript console?  Any errors thrown?
Jaicen83Jaicen83
.
sorttable.js:2 Uncaught SyntaxError: Unexpected token <

DependentPicklist:13 Uncaught ReferenceError: sforce is not defined

https://login.salesforce.com/17181/logo180.png Failed to load resource: the server responded with a status of 404 (Not Found)


.
Jaicen83Jaicen83
/**
 * getDependentPicklistOptions
 *
 * Build an Object in which keys are valid options for the controlling field
 * and values are lists of valid options for the dependent field.
 *
 * Method: dependent PickListEntry.validFor provides a base64 encoded
 * string. After decoding, each of the bits (reading L to R)
 * corresponds to the picklist values for the controlling field.
 */
function getDependentOptions (objName, ctrlFieldName, depFieldName) {
	// Isolate the Describe info for the relevant fields
	var objDesc = sforce.connection.describeSObject(objName);
	var ctrlFieldDesc, depFieldDesc;
	var found = 0;
	for (var i=0; i<objDesc.fields.length; i++) {
		var f = objDesc.fields[i];
		if (f.name == ctrlFieldName) {
			ctrlFieldDesc = f;
			found++;
		} else if (f.name == depFieldName) {
			depFieldDesc = f;
			found++;
		}
		if (found==2) break; 
	}

	// Set up return object
	var dependentOptions = {};
	var ctrlValues = ctrlFieldDesc.picklistValues;
	for (var i=0; i<ctrlValues.length; i++) {
		dependentOptions[ctrlValues[i].label] = [];
	}

	var base64 = new sforce.Base64Binary("");
	function testBit (validFor, pos) {
		var byteToCheck = Math.floor(pos/8);
		var bit = 7 - (pos % 8);
		return ((Math.pow(2, bit) & validFor.charCodeAt(byteToCheck)) >> bit) == 1;
	}
	
	// For each dependent value, check whether it is valid for each controlling value
	var depValues = depFieldDesc.picklistValues;
	for (var i=0; i<depValues.length; i++) {
		var thisOption = depValues[i];
		var validForDec = base64.decode(thisOption.validFor);
		for (var ctrlValue=0; ctrlValue<ctrlValues.length; ctrlValue++) {
			if (testBit(validForDec, ctrlValue)) {
				dependentOptions[ctrlValues[ctrlValue].label].push(thisOption.label);
			}
		}
	}
	return dependentOptions;
}

/*
var OBJ_NAME = 'Custom_Object__c';
var CTRL_FIELD_NAME = "Controlling_Field__c";
var DEP_FIELD_NAME = "Dependent_Field__c";
var options = getDependentOptions(OBJ_NAME, CTRL_FIELD_NAME, DEP_FIELD_NAME);
console.debug(options);
*/
AndrewTaylorAndrewTaylor
Looks like this line could be your problem: <script src="sorttable.js"></script>

Is this from a Static Resource? Or were you referencing a Salesforce library file?  If so, you'll need to see if that file is still available.
 
Jaicen83Jaicen83
Put in the sort table as a static resource aand referenced it.

<apex:includeScript value="{!$Resource.sorttable}"  />

problem still exists think that it may be a problem with the dependant picklist.


var objDesc = sforce.connection.describeSObject(objName);
 
AndrewTaylorAndrewTaylor
"DependentPicklist:13 Uncaught ReferenceError: sforce is not defined" - you might need to load a javascript file to define sforce.