• Raizers
  • NEWBIE
  • 25 Points
  • Member since 2006

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies
First a little background. Our company already has a website that is managed the old fashion way by our IT department. It is massive, complicated, and there is no way on earth we (I am in a separate group from IT) could convince them to convert to Force.com sites. The website has the two typical navigation bars, one along the top and one on the left. So a much more realistic possibility is using an iframe to embed a force.com site/web app within our site.

Here lies the problem. For an iframe that does not need to navigate anywhere we are good, but based on the use case and logic we may want to redirect the users to different pages. I was hoping that in the the page controller, based on the logic, I could set a string which is a URL and then on the completion of this action method call a javascript method. When doing this it appears that the oncomplete attribute of the action method is actually called before all of the variables are set in the controller.

Here is an example:

Code:
Page:

<apex:page controller="iframe">
    <apex:form id="form">
        <apex:inputText value="{!one}"/> + <apex:inputText value="{!two}"/> = 8 <br/>
        <apex:commandButton value="Validate" action="{!submit}" rerender="form" oncomplete="done();"/>
        
        <script type="text/javascript">
            function done(){
                var result = '{!result}';
                alert(result);
                <!-- here I could use window.top.location.href = result to redirect the entire page -->
} </script> </apex:form> </apex:page> Controller: public class iframe { public Integer one {get; set;} public Integer two {get; set;} public String result {get; set;} /*In a real world example based on the logic I may want to pass the navigation URL*/ public PageReference submit() { if(one + two == 8){ result = 'You know math!'; // }else{ result = 'Keep trying!'; } system.debug(result ); return null; } }

As you can see if returns the value of the previous action.

1) Enter 4 + 4, it will return null
2) Enter 4 + 2, it will return 'You know math!'

Thanks,
Jason



Message Edited by TehNrd on 12-03-2008 04:36 PM
  • December 04, 2008
  • Like
  • 1

I would like to create a new VF page which accesses a class in a managed package.  I have made the class "global" (along with all the methods inside it.... an irreversible testing mistake).

 

When trying to save the new VF page, I receive an "Error:  The installed managed class xxx.bundle is not visible" .

 

My VF page is:

<apex:page standardController="Opportunity" extensions="xxx.Bundle" sidebar="false" showHeader="false"> <apex:pageBlock title="Bundle"> </apex:pageBlock> </apex:page>

Class code starts with:

 

global class Bundle { ......

 

Any ideas on how to fix this?
 

Struggling with understanding how to create testmethods so I can package my code to move from development to production.   While there is  information in the manuals, blogs, and discussion boards,  creating testmethods is still confusing.   From the discussion boards, I see that I'm not alone.  I've searched, but haven't been able to find an example testmethod for Lists.....
 
Could someone describe:
- How they determine what needs to be tested,  and
- How they would go about testing the following sample code  (from cookbook)
and provide testmethod code for this sample List code.
 
Code:
VF Page:
<apex:page controller="sampleCon">
<apex:form >
   <apex:selectCheckboxes value="{!countries}">
   <apex:selectOptions value="{!items}"/>
    </apex:selectCheckboxes><br/>
    <apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
</apex:form>
<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="testing...">
   <apex:facet name="stop">
    <apex:outputPanel >
      <p>You have selected:</p>
      <apex:dataList value="{!countries}" var="c">{!c}</apex:dataList>
    </apex:outputPanel>
   </apex:facet>
  </apex:actionstatus>
 </apex:outputPanel>
</apex:page>


CONTROLLER Code:
public class sampleCon {
String[] countries = new String[]{};
public PageReference test() {
return null;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}
public String[] getCountries() {
return countries;
}
public void setCountries(String[] countries) {
this.countries = countries;
}
}

Thanks in advance.... 


 

I would like to create a new VF page which accesses a class in a managed package.  I have made the class "global" (along with all the methods inside it.... an irreversible testing mistake).

 

When trying to save the new VF page, I receive an "Error:  The installed managed class xxx.bundle is not visible" .

 

My VF page is:

<apex:page standardController="Opportunity" extensions="xxx.Bundle" sidebar="false" showHeader="false"> <apex:pageBlock title="Bundle"> </apex:pageBlock> </apex:page>

Class code starts with:

 

global class Bundle { ......

 

Any ideas on how to fix this?
 

Struggling with understanding how to create testmethods so I can package my code to move from development to production.   While there is  information in the manuals, blogs, and discussion boards,  creating testmethods is still confusing.   From the discussion boards, I see that I'm not alone.  I've searched, but haven't been able to find an example testmethod for Lists.....
 
Could someone describe:
- How they determine what needs to be tested,  and
- How they would go about testing the following sample code  (from cookbook)
and provide testmethod code for this sample List code.
 
Code:
VF Page:
<apex:page controller="sampleCon">
<apex:form >
   <apex:selectCheckboxes value="{!countries}">
   <apex:selectOptions value="{!items}"/>
    </apex:selectCheckboxes><br/>
    <apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
</apex:form>
<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="testing...">
   <apex:facet name="stop">
    <apex:outputPanel >
      <p>You have selected:</p>
      <apex:dataList value="{!countries}" var="c">{!c}</apex:dataList>
    </apex:outputPanel>
   </apex:facet>
  </apex:actionstatus>
 </apex:outputPanel>
</apex:page>


CONTROLLER Code:
public class sampleCon {
String[] countries = new String[]{};
public PageReference test() {
return null;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}
public String[] getCountries() {
return countries;
}
public void setCountries(String[] countries) {
this.countries = countries;
}
}

Thanks in advance.... 


 
First a little background. Our company already has a website that is managed the old fashion way by our IT department. It is massive, complicated, and there is no way on earth we (I am in a separate group from IT) could convince them to convert to Force.com sites. The website has the two typical navigation bars, one along the top and one on the left. So a much more realistic possibility is using an iframe to embed a force.com site/web app within our site.

Here lies the problem. For an iframe that does not need to navigate anywhere we are good, but based on the use case and logic we may want to redirect the users to different pages. I was hoping that in the the page controller, based on the logic, I could set a string which is a URL and then on the completion of this action method call a javascript method. When doing this it appears that the oncomplete attribute of the action method is actually called before all of the variables are set in the controller.

Here is an example:

Code:
Page:

<apex:page controller="iframe">
    <apex:form id="form">
        <apex:inputText value="{!one}"/> + <apex:inputText value="{!two}"/> = 8 <br/>
        <apex:commandButton value="Validate" action="{!submit}" rerender="form" oncomplete="done();"/>
        
        <script type="text/javascript">
            function done(){
                var result = '{!result}';
                alert(result);
                <!-- here I could use window.top.location.href = result to redirect the entire page -->
} </script> </apex:form> </apex:page> Controller: public class iframe { public Integer one {get; set;} public Integer two {get; set;} public String result {get; set;} /*In a real world example based on the logic I may want to pass the navigation URL*/ public PageReference submit() { if(one + two == 8){ result = 'You know math!'; // }else{ result = 'Keep trying!'; } system.debug(result ); return null; } }

As you can see if returns the value of the previous action.

1) Enter 4 + 4, it will return null
2) Enter 4 + 2, it will return 'You know math!'

Thanks,
Jason



Message Edited by TehNrd on 12-03-2008 04:36 PM
  • December 04, 2008
  • Like
  • 1
Does Apex support any file I/O

Here is what I need to be able to do:

I have standard pdf document which has an underlying XML schema.

I need to fill out some information in this pdf (programatically) and e-mail it a contact.

Anyway to do it in Apex?

I know there is an xmlStreamReader and xmlStreamWriter class, but it is not apparent how I would use them to do file i/o to a pdf document (from which I can extract an XML)




We use the Print Anything appexchange product to render complex quotes in html.  My users currently print to a pdf, save locally, return to the quote they launch the print from and attach the local file.  We would like to accomplish all of that from the browser with one click.
 
Has anyone seen or created a solution to do this?
 
- Thanks!
In our shop, Salesforce is replacing a currently working, locally developed app for managing contracts.  Main objective for the initial implementation is to use Print Anything to print contracts/agreements created using Salesforce.  We already have a full suite of PDF templates for the different record types and I would like to use those templates as part of the print process using Print Anything if possible.
 
I know a new standard HTML template for Print Anything would need to be created but I'm seeking to use our PDF templates.  Is this something that is being considered by someone who is close enough to PA to be able to include this print method?
 
In the meantime, if there is some documentation available on how to set up Print Anything over and above what comes with the implementation, I'd love to take a look at it.
Are there any facilities to serve up some data on the server in the form of a pdf?

Thx!