Link on current Visualforce page to render as PDF - apex-code

I have a custom built list report page created using Visual force. A link on each row opens up the object details in a new visual force page. I need to have two buttons. One to save/open the current page with all of its information as a PDF and the other button to open the print dialog.
For the button to render current page as PDF, I am assuming its something simple. Remember when the page was first created, it was being passed the record ID as a parameter.
Thanks,
Calvin

To render a page as a PDF just requires adding a renderAs="PDF" attribute to the apex:page tag. This value can be dynamic, as in: <apex:page renderAs="{!ISNULL($CurrentPage.parameters.p),'','PDF')}">
This would render the page as HTML if there was no parameter named "p" included in the URL (e.g. /apex/myPage?id=someId), and as a PDF if this param was included (e.g. /apex/myPage?id=someId&p=1).
To make it render the current page as a PDF I'd just have the button refresh the page and add the parameter.

Related

Oracle APEX takes a value from a function and uses it to open a new page

I have a function that returns a value (e.g.27).
I am put this value to my page item (P2120_SYMPTOM_ID) and i want with this value to open with button another page (P2140).
I am going to button Link builder - target and i am using P2120_SYMPTOM_ID like this:
but unfortunatendly this value doesn't pass to my new page criteria.
How can i use this value?
If you're just navigating to another page (as opposed to opening a modal window) then use action "Submit" on your button and create a branch to the new page. That is how navigation is supposed to be done. The link builder links are generated when the page is rendered and do not pick up session values.
This is a common question, and relates to the fact the link uses values during page render, not what may have happened during interaction with the page
A common solution is presented in the Oracle forums here
https://community.oracle.com/tech/developers/discussion/3725149/pass-client-side-state-to-modal-dialog
Alternatively, there is a free & supported FOEX Redirect plugin that also solves this problem
https://fos.world/ords/f?p=10000:1080

BIRT: Setting Birt viewer paratmer and tag attributes from javascript

I want to go to a specific page through a button/text item click event. I have put a text item and written an html script make it a button. I want to go to a specific page by setting the __page parameter or calling a bookmark to load.
Can someone please tell me how can I do it through javascript in the html body of a text item
Thanks
Syed

How to change DIV content in a different page?

I know there is ways to change DIV content within a single page. Using Ajax for example to dynamically get div content from an external .html file and then replace Div content using load or get functions.
However, is there a way to do this on a different page?
For example, say there is 2 pages. One.html, and Two.html.
I want a button on the first page (One.html), that when clicked, will change DIV content (by default the div box is empty, I want the button to insert text into the box basically) for a specific DIV Id on page 2 (Two.html).
So the process is basically: Click button on One.html, some function gets div content from external html (Three.html for example), and the uses that content to update an empty div on Two.html. Also, I would like to load some basic CSS in a similar fashion. Not only insert text into the box, but also change the background color and text color.
Thank You!
You just store the info and send it to the next page, say, with the HTTP request and submit methods get and post.
http://www.w3schools.com/tags/ref_httpmethods.asp

Ajax Load Div based on URI (Instead of onClick)

I am converting an old web application. In the legacy version, there is a page which displays some default content when the user navigates to it. There is a link within that page which reloads the page but with a querystring showform=yes which causes a form to be displayed instead of the content.
In the old version, the page was like this:
http://site.com/directory.asp - for the main page with the content
http://site.com/directory.asp?showform=yes - called when the user
clicked the button to show the form.
In the new version of the web app, that same page is set up with ajax, in that there is a div which contains the default content when someone visits http://site.com/directory. There is a button, which, when clicked (from within that page), some ajax is invoked which swaps out the content and displays the form. There is no change in the URI/querystring.
Here is my question - In the legacy version of the web app, there are some other pages which link the user directly to the page with the form (http://site.com/directory.asp?showform=yes) e.g. so they don't need to click the button once the arrive at directory.asp.
Is there a what I can mimimc this behavior based on how I have that page set up now e.g. displaying the form via ajax in a div?)
Initially I thought that perhaps ajax can be triggered based on the presence of a querystring or an anchor in the URI e.g. /directory#form but I am not sure if that is possible.
I would prefer a solution that is not dependent on jQuery, but will consider it if there are no other options.
Thanks in advance for looking, and please let me know if I can further clarify.
Thanks,
Gary
yes you can trigger AJAX call on the basis of a boolean variable which you can set through the query string.
The default value for the boolean variable is false which forces the user to click on the button to refresh the form section.
But when the comes back on the same page the query string will set the boolean variable to true whereby the javascript function containing the AJAX code is invoked from your JSP/ASP or HTML.

Telerik RadWindow without NavigateURL?

I want a modal popup effect to display dynamic content on a single page. I'm working with Telerik controls. Telerik has a control called RadWindow which is more or less a modal window.
It looks like the only content that is to be displayed in RadWindow is the content of a page that is specified in NavigateURL. That is a problem for me because what I want to display is the dynamic content that I show on the same page.
Is it possible to display content that is on the same page using RadWindow?
The RadWindow is an iframe. It has to have a separate page to render, unless you use the clientside radalert and radconfirm methods--you can pass in HTML for an alert or confirm dialog that doesn't require a separate page. That doesn't sound like what you want. Consider using the RadToolTip or the AjaxToolkit ModalPopupExtender instead.
RadDock does what RadWindow does. Only, it takes input from the current page instead of from an external URL.
For some time, RadWindow can display content from the main page as well. Here is a link to the demo:
http://demos.telerik.com/aspnet-ajax/window/examples/internalcontent/defaultcs.aspx

Resources