• Lorenz
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hi all,

 

I am developing a managed package with VisualforcePages containing a lot of Javascript code.

This Code contains Function-calls to a Javascript "Class" Customizations. 

 

When I deploy a package to an end customer the packaged VisualforcePages are read-only. Therefore I need a way to provide the possibility to our end customers that they can create a new VisualforcePage where they define a Javascript Object Customizations which is being called by our packaged code.

 

The part where I want to include the Custom VisualforcePage

The intention here is, that the VisualforcePage is only imported into the code if the Page exists

 

<apex:outputPanel rendered="{!!ISBLANK($Setup.cnx__Settings__c.cnx__Custom_Pagename__c)}">
    // This code is only executed if the custom pagename is defined
    <apex:include pageName="{!JSENCODE($Setup.cnx__Settings__c.cnx__Custom_Pagename__c)}" />
    <script type="text/javascript">
        // init customer configuration
        if(typeof Customizations === 'function') { 
            var custom = new Customizations();
        }
    </script>
</apex:outputPanel>

 

The custom VisualForce Page not part of the managed package 

This VisualforcePage is created by the Customer and is not part of the managed package and will be included with the code-listing above if the page exists

 

<apex:page >
    <script type="text/javascript">
        function Customizations()
        {
            this.GetSettings = function(data) {
                //manipulate the data here
                return data;
            }
            this.ContactLookup = function(data) {
                //create a ContactLookup here
                return data;
            }

            // ...
        }
    </script>
</apex:page>

 

This code works flawlessly if the ...Custom_Pagename__c Custom Setting is defined and contains a value. The problem arises if the custom setting is set to ''.

 

I always get the following error:

The name '' can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores. 


In my understanding the code between <apex:outputPanel></apex:outputPanel> should only be evaluated if the rerended attribute is TRUE. correct?

 

Does anyone have a suggestion how to solve this issue?

 

 

Thanks

 

Lorenz

  • February 15, 2012
  • Like
  • 0

Hi all,

 

I am developing a managed package with VisualforcePages containing a lot of Javascript code.

This Code contains Function-calls to a Javascript "Class" Customizations. 

 

When I deploy a package to an end customer the packaged VisualforcePages are read-only. Therefore I need a way to provide the possibility to our end customers that they can create a new VisualforcePage where they define a Javascript Object Customizations which is being called by our packaged code.

 

The part where I want to include the Custom VisualforcePage

The intention here is, that the VisualforcePage is only imported into the code if the Page exists

 

<apex:outputPanel rendered="{!!ISBLANK($Setup.cnx__Settings__c.cnx__Custom_Pagename__c)}">
    // This code is only executed if the custom pagename is defined
    <apex:include pageName="{!JSENCODE($Setup.cnx__Settings__c.cnx__Custom_Pagename__c)}" />
    <script type="text/javascript">
        // init customer configuration
        if(typeof Customizations === 'function') { 
            var custom = new Customizations();
        }
    </script>
</apex:outputPanel>

 

The custom VisualForce Page not part of the managed package 

This VisualforcePage is created by the Customer and is not part of the managed package and will be included with the code-listing above if the page exists

 

<apex:page >
    <script type="text/javascript">
        function Customizations()
        {
            this.GetSettings = function(data) {
                //manipulate the data here
                return data;
            }
            this.ContactLookup = function(data) {
                //create a ContactLookup here
                return data;
            }

            // ...
        }
    </script>
</apex:page>

 

This code works flawlessly if the ...Custom_Pagename__c Custom Setting is defined and contains a value. The problem arises if the custom setting is set to ''.

 

I always get the following error:

The name '' can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores. 


In my understanding the code between <apex:outputPanel></apex:outputPanel> should only be evaluated if the rerended attribute is TRUE. correct?

 

Does anyone have a suggestion how to solve this issue?

 

 

Thanks

 

Lorenz

  • February 15, 2012
  • Like
  • 0