• pcal
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies
Hi all.  Quick question: is there any way to access the content of a static resource from Apex code?

I know how to access the resource inside VF markup (URLFOR, $Resource); what I'm trying to do here is get at the contents of an XML or text file resource from within an Apex method.

I couldn't find an API for doing this.  The only thing I could think of was to do an HTTP callout, but that seems to give me a 404 no matter what I do; I gather there is a proxy back there that has a different view of the world than my browser does.

Is there a better way to go about this?

Thanks very much,
-p

  • August 29, 2008
  • Like
  • 0
Hi all.  I'm looking for general guidance on the best way to handle the following situation:  I have a high level structure like this:

Code:
<apex:page>
  <apex:form>
    <c:myComponent />
  <apex:form>
</apex:page>

where 'myComponent' is a component that ends up outputting another apex:form tag.

I gather that VF does not like the nested forms - it complains with something like

'c:myComponent' component cannot be nested within form tags

I believe this kind of thing is pretty unavoidable in our design - typically those components are outputting a commandLink or some other thing that requires an enclosing form.

We've considered a couple of alternatives for structuring our pages to avoid this.  The current frontrunner is to do the following:

- Declare a single apex:form at the page level
- Cordon off the various areas of responsibility using actionRegions instead of form tags

Does that seem like a reasonable solution, or should we consider another approach?

Thanks very much in advance.


Message Edited by pcal on 08-13-2008 06:18 PM
  • August 14, 2008
  • Like
  • 0
Is there any way for a page controller and custom component controller on a page to find each other and talk to one another? 

For complex pages, I'd like to be able to encapsulate different areas of functionality between different components, but still have the ability for the components to pass messages to each other.

For example, consider a page that has a query builder form and a result pane.  I'd like to have one component/controller handle a complex UI mechanism for building up a query and another component/controller that handles the retrieval and display of results.

I understand most of how to do this, but I don't see how I can get the components to talk to each other.  When the user clicks 'Run Query!' on the query component, I need that controller to take all of the UI inputs, assemble a query string, and then pass that result over to the result component and perform a refresh.

How should I go about achieving something like this in VisualForce?  I realize I could do it with one giant page controller that handles everything, but I'm hoping to get a more elegant separation of concerns here (my actual case is a bit more complicated than I describe here).

Thanks much in advance.

-Patrick
  • August 01, 2008
  • Like
  • 0
I am attempting to package up my application and am now seeing this error any time my code tries to run a simple query against my custom objects.  This used to work when I ran things unpackaged.

I know this is a difficult thing to just diagnose in the forum, but I'm wondering if anyone has any guidance as to what this might mean?  Which package restrictions should I be looking for?  I've poured over the package panel and nothing is jumping out at me.

Thanks in advance.

  • July 29, 2008
  • Like
  • 0
Is there a way to get the 'raw' output of an Apex controller or VisualForce page?

My problem:

I'm trying to wire up the extjs tree control to display a tree of my custom objects.  The extjs tree widget wants a URL that will describe the tree structure in JSON format.

I can generate the JSON, and I can display it in a visualforce page per the docs, but that includes the entire application frame; I need to be able to give the widget a URL to the raw JSON document.

What is the best way to go about doing this kind of thing?

Thanks very much in advance.  (And apologies if I'm missing something obvious - I'm a newbie).
  • July 15, 2008
  • Like
  • 0
Hi all.  Quick question: is there any way to access the content of a static resource from Apex code?

I know how to access the resource inside VF markup (URLFOR, $Resource); what I'm trying to do here is get at the contents of an XML or text file resource from within an Apex method.

I couldn't find an API for doing this.  The only thing I could think of was to do an HTTP callout, but that seems to give me a 404 no matter what I do; I gather there is a proxy back there that has a different view of the world than my browser does.

Is there a better way to go about this?

Thanks very much,
-p

  • August 29, 2008
  • Like
  • 0
Hi all.  I'm looking for general guidance on the best way to handle the following situation:  I have a high level structure like this:

Code:
<apex:page>
  <apex:form>
    <c:myComponent />
  <apex:form>
</apex:page>

where 'myComponent' is a component that ends up outputting another apex:form tag.

I gather that VF does not like the nested forms - it complains with something like

'c:myComponent' component cannot be nested within form tags

I believe this kind of thing is pretty unavoidable in our design - typically those components are outputting a commandLink or some other thing that requires an enclosing form.

We've considered a couple of alternatives for structuring our pages to avoid this.  The current frontrunner is to do the following:

- Declare a single apex:form at the page level
- Cordon off the various areas of responsibility using actionRegions instead of form tags

Does that seem like a reasonable solution, or should we consider another approach?

Thanks very much in advance.


Message Edited by pcal on 08-13-2008 06:18 PM
  • August 14, 2008
  • Like
  • 0
Is there any way for a page controller and custom component controller on a page to find each other and talk to one another? 

For complex pages, I'd like to be able to encapsulate different areas of functionality between different components, but still have the ability for the components to pass messages to each other.

For example, consider a page that has a query builder form and a result pane.  I'd like to have one component/controller handle a complex UI mechanism for building up a query and another component/controller that handles the retrieval and display of results.

I understand most of how to do this, but I don't see how I can get the components to talk to each other.  When the user clicks 'Run Query!' on the query component, I need that controller to take all of the UI inputs, assemble a query string, and then pass that result over to the result component and perform a refresh.

How should I go about achieving something like this in VisualForce?  I realize I could do it with one giant page controller that handles everything, but I'm hoping to get a more elegant separation of concerns here (my actual case is a bit more complicated than I describe here).

Thanks much in advance.

-Patrick
  • August 01, 2008
  • Like
  • 0
I am attempting to package up my application and am now seeing this error any time my code tries to run a simple query against my custom objects.  This used to work when I ran things unpackaged.

I know this is a difficult thing to just diagnose in the forum, but I'm wondering if anyone has any guidance as to what this might mean?  Which package restrictions should I be looking for?  I've poured over the package panel and nothing is jumping out at me.

Thanks in advance.

  • July 29, 2008
  • Like
  • 0
Is there a way to get the 'raw' output of an Apex controller or VisualForce page?

My problem:

I'm trying to wire up the extjs tree control to display a tree of my custom objects.  The extjs tree widget wants a URL that will describe the tree structure in JSON format.

I can generate the JSON, and I can display it in a visualforce page per the docs, but that includes the entire application frame; I need to be able to give the widget a URL to the raw JSON document.

What is the best way to go about doing this kind of thing?

Thanks very much in advance.  (And apologies if I'm missing something obvious - I'm a newbie).
  • July 15, 2008
  • Like
  • 0