• thecoldfusion
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 11
    Replies
Hello,

I am having issue with DatePicker not popping up automatically. In fact, it does not pop up at all. My input field is definitely a date field. Firebug reports problem like this :-

Error:
this.div is null
https://na3.salesforce.com/dJS/en/1219782666000/library.js
Line 22568

this.div is null
iframeShim(null)library.js (line 22568)
DatePicker()library.js (line 7537)
pickDate()(true, "j_id0:j_id1:j_id134:j_id135:j_id215:j_id216:j_id220:0:j_id224", false, undefined)library.js (line 7795)
onfocus(focus )IPPage—i...FLg%3D%3D (line 2)
[Break on this error] if (this.div.currentStyle) {

 Could anyone help me?

Thanks

Hello,

I like the concept of using custom component to encapsulate generalized UI and being able to use in more than one visual force page with different sets of data.

However, I have a situation where I use apex components, within a custom component, with id attributes. This is creating a problem when multiple instances of the custom component is used in same visual force page.

Is this a serious limitation? Something like 'prependId' attribute, of an <apex:form> tag, could help - so that unique child client-ids could be generated for all tags/components inside a custom component and provide some mechanism to refer it in attributes like 'rerender', 'status' etc (just like using {!$Component} object in a javascript DOM to access HTML objects).

My situation:
The controller class IPIBAs guarantees different sets of data with different parameters. The controller used in the page has multiple references to instances of IPIBAs created with different parameters.


Component Code:
<apex:component>
  <apex:attribute required="true" name="ipIBAs" type="IPIBAs" description="" />
  <apex:outputPanel style="height:15px;" layout="block">
    <apex:actionStatus startText="loading..." stopText="" id="panelIPIBAsStatusLoading" />
    <apex:actionStatus startText="saving..." stopText="" id="panelIPIBAsStatusSaving" />
    <apex:actionStatus startText="cancelling..." stopText="" id="panelIPIBAsStatusCancelling" />
    <apex:actionStatus startText="deleting..." stopText="" id="panelIPIBAsStatusDeleting" />
  </apex:outputPanel>
  <apex:outputPanel id="panelIPIBAs" layout="block">
    <apex:form rendered="{!(ipIBAs.viewMode == 1)}">
      <apex:pageBlock title="Activities :: Listings">
        <apex:pageBlockButtons>
          <apex:commandButton value="Edit" rerender="panelIPIBAs" rendered="{!(ipIBAs.ipIBAsCount > 0)}" status="panelIPIBAsStatusLoading">
            <apex:param value="2" assignTo="{!ipIBAs.viewMode}" />
          </apex:commandButton>
        </apex:pageBlockButtons>
<!-- other fields here -->
</apex:pageBlock> </apex:form> <apex:form rendered="{!(ipIBAs.viewMode == 2)}"> <apex:pageBlock title="Activities :: Edit"> <apex:pageBlockButtons> <apex:commandButton value="Save" rerender="panelIPIBAs" action="{!ipIBAs.save}" status="panelIPIBAsStatusSaving" /> <apex:commandButton value="Cancel" rerender="panelIPIBAs" action="{!ipIBAs.cancel}" status="panelIPIBAsStatusCancelling" /> </apex:pageBlockButtons>
<!-- other fields here -->
</apex:pageBlock>
</apex:form>
<apex:form rendered="{!(ipIBAs.viewMode == 3)}">
<apex:pageBlock title="Activities :: New">
<apex:pageBlockButtons>
<apex:commandButton value="Save" rerender="panelIPIBAs" action="{!ipIBAs.saveNewRecord}" status="panelIPIBAsStatusSaving" />
<apex:commandButton value="Cancel" rerender="panelIPIBAs" action="{!ipIBAs.cancelNewRecord}" status="panelIPIBAsStatusCancelling" />
</apex:pageBlockButtons>
<!-- other fields here -->
</apex:pageBlock>
</apex:form>
<apex:form rendered="{!(ipIBAs.viewMode == 4)}">
<apex:pageBlock title="Activities :: Confirm Delete">
<apex:pageBlockButtons>
<apex:commandButton value="Yes" rerender="panelIPIBAs" action="{!ipIBAs.deleteSelected}" status="panelIPIBAsStatusDeleting" />
<apex:commandButton value="No" rerender="panelIPIBAs" action="{!ipIBAs.cancelDelete}" status="panelIPIBAsStatusCancelling" />
</apex:pageBlockButtons>
<!-- other fields here -->
</apex:pageBlock>
</apex:form>
</apex:outputPanel>
</apex:component>

 
Whenever I try to include two or more of this component, I get

Error: Duplicate ids have been detected: 'panelIPIBAsStatusLoading'

How could visualforce ensure unique 'clientid's would be generated for child components of a custom component?

Any suggessions?

Thanks,
TheColdFusion
Hi,

I posted a message in Apex board. Here is the link http://community.salesforce.com/sforce/board/message?board.id=apex&thread.id=6190

It is related to both apex and visualforce so I posted this message here too.
Please help.

Thanks
thecoldfusion
Hello,

I am having a requirement where an apex class should update some of the fields of a given custom object.

=============================================================================================

Here is my setup:

Key Points:
- Page implements tabbed navigation of logical sets of fields for view, edit, save etc.
- Fields a__c through e__c, here, are compacted and represent groups of related fields.


Extended controller:
public AssetController
{
   ...
   ...
   private Id aId;
   private Asset__c asset;
   
   public ControllerA controllerA {public get; private set;}
   public ControllerB controllerB {public get; private set;}
   .
   .
   .
   public ControllerE controllerE {public get; private set;}
   
   public Controller1(ApexPages.StandardController controller)
   {
      aId = ((Asset__c) controller.getRecord()).id;
      this.asset = [SELECT a__c, b__c, c__c, d__c, e__c FROM Asset__c WHERE Id = :this.aId];
      this.controllerA = new ControllerA(this, this.asset);
      this.controllerB = new ControllerB(this, this.asset);
      .
      .
      .
      this.controllerE = new ControllerE(this, this.asset);
}
...
...
...
// this method to be used to make sure records are saved
// when user navigates away from current page
// not used at the moment
private AssetController::save()
{
// to be filled
}
}

Helper classes:
public class ControllerA
{
    private AssetController ac;
    public Asset__c asset {public get; private set;}
    public Integer viewMode {public get; public set;}

public ControllerA(AssetController ac, Asset__c asset) { this.ac = ac; this.asset = asset; this.viewMode = 1; // 1 = view, 2 = edit
// enums would do fantastic job but i can't get enums in vf page :(
}

// called from VF component
public PageReference save() {
// *****************************************
// here, i need to update asset.a__c only... // *****************************************
} }

.
.
.

public class ControllerE
{
private AssetController ac;
public Asset__c asset {public get; private set;}

public ControllerA(AssetController ac, Asset__c asset)
{
this.ac = ac;
this.asset = asset;
this.viewMode = 1; // 1 = view, 2 = edit
// enums would do fantastic job but i can't get enums in vf page :(
}

// called from VF component
public PageReference save()
{
// *****************************************
// here, i need to update asset.e__c only...
// *****************************************
}
}

 
Page: AssetsPage

<apex:page standardController="Asset__c" extensions="AssetController"> <apex:tabPanel switchType="client" selectedTab="tabA"> <apex:tab label="GroupA" name="tabA"> <c:LogicalGroupA controllerA="{!controllerA}" /> </apex:tab> . . . <apex:tab label="GroupE" name="tabE"> <c:LogicalGroupE controllerE="{!controllerE}" /> </apex:tab> </apex:tabPanel> </apex:page>


Component: LogicalGroupA

<apex:component>
    <apex:attribute required="true" type="ControllerA" name="controllerA" description="" />
    <apex:outputPanel id="groupPanel" layout="block">
    <!------ this is where i wanted to use enums for view/edits ------>
<apex:form rendered="{!(controllerA.viewMode == 1)}"> <apex:pageBlock> <apex:pageBlockButtons> <apex:commandButton value="Edit" rerender="groupPanel"> <apex:param value="2" assignTo="{!controllerA.viewMode}" /> </apex:commandButton> </apex:pageBlockButtons> <apex:pageBlockSection> <apex:outputField value="{!controllerA.asset.a__c}" /> </apex:pageBlockSection> </apex:pageBlock> </apex:form>
<!------ this is where i wanted to use enums for view/edits ------>
<apex:form rendered="{!(controllerA.viewMode == 2)}"> <apex:pageBlock> <apex:pageBlockButtons> <apex:commandButton value="Save" rerender="groupPanel" action="{!controllerA.save}"> <apex:param value="2" assignTo="{!controllerA.viewMode}" /> </apex:commandButton> </apex:pageBlockButtons> <apex:pageBlockSection> <apex:inputField value="{!controllerA.asset.a__c}" /> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:component>

same logic for LogicalGroupB through LogicalGroupE

=============================================================================================

If i "update this.asset" in ControllerA::save() method, I get

Error:

System.Exception: DML currently not allowed

Class.ControllerA.save: line __, column __
External entry point


Qs:
1. Is there a work around to the error? Why such exception from action method? Does it have to be in AssetController::save()?
2. How to update partial fields (a__c only), since my custom object (asset) already has fields (b__c,... e__c) in ControllerA through ControllerE?
3. Is there a way to use enums in VF pages/components?
4. A 1 to 1 relation maped object would solve the purpose, I think, since all those 5 fields would come from 5 different custom objects. Is there such provision in salesforce platform? (Other than having a Parent-Child relationship and making sure only one child object will ever be created!)


Regards,
thecoldfusion
Hello everyone,

I was wondering what is to be done to fix this problem from saying

Error:
Internet Explorer cannot open the Internet site https://na3.salesforce.com/<Object-ID>
Operation aborted

 

Details on the page:
1. Page layout contains visual force page using extended controller on a custom object.
2. Works fine in Firefox, Safari, and Opera.
3. When accessing https://na3.salesforce.com/apex/visualForcePage?id=<Object-Id>, the same error pops up followed by

Error:
A Runtime Error has occurred.
Do you wish to debug?
Line 21
Error: Permission denied

Breaking on the debugger shows the following line highlighted

Code:
if (this.contentWindow.location.pathname != '/blank.html')

 which is part of

Code:
<iframe onload="if (this.contentWindow.location.pathname != '/blank.html') { if (true) { initContentPane('/apex/visualForcePage?id=<Object-Id>&amp;core.apexpages.devmode.url=1') } }" style="width: 100%; height: 100%" frameBorder="0" src="/blank.html" name="contentPane" id="contentPane"></iframe>

 

Clicking 'No' on the permission denied error box will load the infamous

Page:
Internet Explorer cannot display the webpage

4. When accessing https://na3.salesforce.com/apex/visualForcePage, IE displays the page (with structures only and no data which is how the extended controller is written.)


Hello,

I am having issue with DatePicker not popping up automatically. In fact, it does not pop up at all. My input field is definitely a date field. Firebug reports problem like this :-

Error:
this.div is null
https://na3.salesforce.com/dJS/en/1219782666000/library.js
Line 22568

this.div is null
iframeShim(null)library.js (line 22568)
DatePicker()library.js (line 7537)
pickDate()(true, "j_id0:j_id1:j_id134:j_id135:j_id215:j_id216:j_id220:0:j_id224", false, undefined)library.js (line 7795)
onfocus(focus )IPPage—i...FLg%3D%3D (line 2)
[Break on this error] if (this.div.currentStyle) {

 Could anyone help me?

Thanks

Hello,

I like the concept of using custom component to encapsulate generalized UI and being able to use in more than one visual force page with different sets of data.

However, I have a situation where I use apex components, within a custom component, with id attributes. This is creating a problem when multiple instances of the custom component is used in same visual force page.

Is this a serious limitation? Something like 'prependId' attribute, of an <apex:form> tag, could help - so that unique child client-ids could be generated for all tags/components inside a custom component and provide some mechanism to refer it in attributes like 'rerender', 'status' etc (just like using {!$Component} object in a javascript DOM to access HTML objects).

My situation:
The controller class IPIBAs guarantees different sets of data with different parameters. The controller used in the page has multiple references to instances of IPIBAs created with different parameters.


Component Code:
<apex:component>
  <apex:attribute required="true" name="ipIBAs" type="IPIBAs" description="" />
  <apex:outputPanel style="height:15px;" layout="block">
    <apex:actionStatus startText="loading..." stopText="" id="panelIPIBAsStatusLoading" />
    <apex:actionStatus startText="saving..." stopText="" id="panelIPIBAsStatusSaving" />
    <apex:actionStatus startText="cancelling..." stopText="" id="panelIPIBAsStatusCancelling" />
    <apex:actionStatus startText="deleting..." stopText="" id="panelIPIBAsStatusDeleting" />
  </apex:outputPanel>
  <apex:outputPanel id="panelIPIBAs" layout="block">
    <apex:form rendered="{!(ipIBAs.viewMode == 1)}">
      <apex:pageBlock title="Activities :: Listings">
        <apex:pageBlockButtons>
          <apex:commandButton value="Edit" rerender="panelIPIBAs" rendered="{!(ipIBAs.ipIBAsCount > 0)}" status="panelIPIBAsStatusLoading">
            <apex:param value="2" assignTo="{!ipIBAs.viewMode}" />
          </apex:commandButton>
        </apex:pageBlockButtons>
<!-- other fields here -->
</apex:pageBlock> </apex:form> <apex:form rendered="{!(ipIBAs.viewMode == 2)}"> <apex:pageBlock title="Activities :: Edit"> <apex:pageBlockButtons> <apex:commandButton value="Save" rerender="panelIPIBAs" action="{!ipIBAs.save}" status="panelIPIBAsStatusSaving" /> <apex:commandButton value="Cancel" rerender="panelIPIBAs" action="{!ipIBAs.cancel}" status="panelIPIBAsStatusCancelling" /> </apex:pageBlockButtons>
<!-- other fields here -->
</apex:pageBlock>
</apex:form>
<apex:form rendered="{!(ipIBAs.viewMode == 3)}">
<apex:pageBlock title="Activities :: New">
<apex:pageBlockButtons>
<apex:commandButton value="Save" rerender="panelIPIBAs" action="{!ipIBAs.saveNewRecord}" status="panelIPIBAsStatusSaving" />
<apex:commandButton value="Cancel" rerender="panelIPIBAs" action="{!ipIBAs.cancelNewRecord}" status="panelIPIBAsStatusCancelling" />
</apex:pageBlockButtons>
<!-- other fields here -->
</apex:pageBlock>
</apex:form>
<apex:form rendered="{!(ipIBAs.viewMode == 4)}">
<apex:pageBlock title="Activities :: Confirm Delete">
<apex:pageBlockButtons>
<apex:commandButton value="Yes" rerender="panelIPIBAs" action="{!ipIBAs.deleteSelected}" status="panelIPIBAsStatusDeleting" />
<apex:commandButton value="No" rerender="panelIPIBAs" action="{!ipIBAs.cancelDelete}" status="panelIPIBAsStatusCancelling" />
</apex:pageBlockButtons>
<!-- other fields here -->
</apex:pageBlock>
</apex:form>
</apex:outputPanel>
</apex:component>

 
Whenever I try to include two or more of this component, I get

Error: Duplicate ids have been detected: 'panelIPIBAsStatusLoading'

How could visualforce ensure unique 'clientid's would be generated for child components of a custom component?

Any suggessions?

Thanks,
TheColdFusion
Hello everyone,

I was wondering what is to be done to fix this problem from saying

Error:
Internet Explorer cannot open the Internet site https://na3.salesforce.com/<Object-ID>
Operation aborted

 

Details on the page:
1. Page layout contains visual force page using extended controller on a custom object.
2. Works fine in Firefox, Safari, and Opera.
3. When accessing https://na3.salesforce.com/apex/visualForcePage?id=<Object-Id>, the same error pops up followed by

Error:
A Runtime Error has occurred.
Do you wish to debug?
Line 21
Error: Permission denied

Breaking on the debugger shows the following line highlighted

Code:
if (this.contentWindow.location.pathname != '/blank.html')

 which is part of

Code:
<iframe onload="if (this.contentWindow.location.pathname != '/blank.html') { if (true) { initContentPane('/apex/visualForcePage?id=<Object-Id>&amp;core.apexpages.devmode.url=1') } }" style="width: 100%; height: 100%" frameBorder="0" src="/blank.html" name="contentPane" id="contentPane"></iframe>

 

Clicking 'No' on the permission denied error box will load the infamous

Page:
Internet Explorer cannot display the webpage

4. When accessing https://na3.salesforce.com/apex/visualForcePage, IE displays the page (with structures only and no data which is how the extended controller is written.)


Hi all,

I've created a visual force page with a controller extension that makes edits to a custom object and a list of related custom objects. I've added a custom validation rule to the related object and I would like the error messages for the related object to appear correctly in the page however only error messages for the parent object which the standard controller handles displayes the validation error correctly. If there is a validation error in the child objects it throws the exception and goes to an ugly exception page.

Here's the save function:

Code:
public PageReference save(){
  upsert PartOrder;

  for(PartOrderPart p: PartOrderParts) {
    p.pop.Part_Order__c = this.PartOrder.Id;
    upsert p.pop;
  }


  PageReference poPage = new PageReference('/' + PartOrder.id);
  poPage.setRedirect(true);
  return poPage;

}

 
I thought about using a try catch to catch the exceptions and store them in an array then display them

Code:
for(PartOrderPart p: PartOrderParts) {
  try {
    p.pop.Part_Order__c = this.PartOrder.Id;
    upsert p.pop;
  } catch (System.DmlException e) {
    //store error in an array
  }

} 

But there's no if type statements in the visualforce tag library so I'm not sure how I would check to see if there are errors and if there are display them, and if not don't display anything. Any help is much appreciated.



Message Edited by Scott.M on 06-03-2008 06:47 AM