passing and getting variables to a cfwindow - coldfusion

I have a table within a form that has many identical rows. At the beginning of each row is a text field and a button that creates a <cfwindow> so that the user can browse an inventory and select a single item. Then I need that item's name and ID to get sent back to the main page and populate the text box.
The main page form works fine. The <cfwindow> works fine (search, display, etc..). I cannot figure out a way to get the variable being set in the <cfwindow> back to the main page and just populate the text field for that specific row and not redraw the entire page. I can't even get the <cfwindow> to access any variable on the main page and I thought that it was just a floating div and would have access to all of the main page variables that are set.
This is one row of the main page (the index is for looping through to create unique names for each row variables):
<cfinput type="button" value="Select" name="xSelect#i#" onClick="ColdFusion.Window.create(blah blah blah...)/>.
<cfinput type="text" name="x1s#i#xName" value="form.x1s#i#xName" size="30" disabled="true"/>
in the <cfwindow>, a query populates a list of items, each with a radio button. User needs to select one and it needs to return that item's ID back to the main page for that row:

I appreciate the feedback. Here's what I ended up doing:
- passed the variables to the cfwindow via url with a button and an onClick="ColdFusion.Window.create..."
- in the cfwindow, I used the url variables as a reference and I have a search dialogue that then sends the search results along with the url variable (via url variables) to a simple action page that just displays a form with the variables populated via an onclick="javascript:ColdFusion.navigate..."
- back in the main page I have a cfdiv that binds to the action page via a url
So by starting with a reference that I pass to my search function, I keep it "tagged" and then every time it is refreshed it shows up in the main page correctly.
So it's working now and the last thing that I need to do is put all my dynamic variables in an array to reduce the overhead.

In ColdFusion you could put something into the session scope or you could use javascript to set hidden fields on the calling page. There may be a nicer solution but that's a couple of quick ones.

Use a Javascript function call in your link on the parent window.
From the Javascript function, use ColdFusion.Window.create to create the child window with a dynamic url passing the vars you need.
Et voilà.

Related

How create a template for a blank page with header, footer and classic reports?

I am using Oracle APEX 21.1. I am developing an app for clinic management. There is a page that should hold the patient's prescription and other data and a header - data displayed on every page at the top and a footer - data displayed at the bottom of every page. All regions in the page are based on classic reports. The page should be printed using Ctrl+p browser command.
I need to create a blank page that has nothing but the classic reports regions. And I need those regions to be displayed each as per to their template. I tried modifying the Standard page template by removing many <div> elements and classes but the result is not good at all.
Sometimes, the browser displays two pages to print when there is only one. Other times, the classic reports are not displayed correctly. Is there a way to create such a template that has nothing but a header, a footer and classic reports that retain their styling?
ws= eslam_ws
un= forhelp
pwd= Forhelppwd$
You don't need to modify the page template to accomplish this.
1 - Create a blank page. Go to properties. Set template to "Minimal (no navigation)".
2 - Create 3 regions:
Call the first "Header" go to properties set position to "Breadcrumb Bar".
Call the second "Body" go to properties set position to "Body"
Call the third "Footer" go to properties set position to "Footer".
Done. You can put inside these regions whatever you want.

Calling a non-modal dialog page passing IR report ID in page url

I am trying to change all popup pages in an app from normal page template to non-modal-dialog page template in apex 5.1
I'll try to describe the complete use-case:
I have an Interactive report page with link columns for each record which opens a dialog window where users can edit/interact with the record.
The dialog has Previous/Next buttons to allow users to navigate through the records.
When a filter is set on the report, the dialog window should take this into account in the Next/Previous behavior.
For e.g. if the report filter selects only one row, then the dialog window Next/Previous buttons are disabled because there are no more rows shown by the report to navigate through.
For this functionalities, I need to pass the IR-report ID to the non-modal page.
Now the href property of the link column in the IR report should be something like:
javascript:apex.navigation.dialog('f?p=123:40:12345678:::40:P40_SIGNAL_DEF_ID,P40_IR_REPORT_ID,P40_MODE:42,41982451655076402,E&p_dialog_cs=NwEcqexhNPGD1VziCXol65xHCP8',{title:'SIGNALS_DIGITAL',height:'auto',width:'720',maxWidth:'960',modal:false,dialog:null},'t-Dialog-page--standard '+'',apex.jQuery('#myStaticID'));
Only two parts in this link I am concerned about. One is the checksum part (p_dialog_cs=NwEcqexhNPGD1VziCXol65xHCP8) and other part is the IR report ID(41982451655076402) I used apex_util.prepare_url function in the SQL query but this is not returning IR report ID something like :
javascript:apex.navigation.dialog('f?p=123:40:12345678:::40:P40_SIGNAL_DEF_ID,P40_IR_REPORT_ID,P40_MODE:42,,E&p_dialog_cs=NwEcqexhNPGD1VziCXol65xHCP8',{title:'SIGNALS_DIGITAL',height:'auto',width:'720',maxWidth:'960',modal:false,dialog:null},'t-Dialog-page--standard '+'',apex.jQuery('#myStaticID'));
I am not able to get the IR report ID here I tried using $v("myStaticID_report_id") inside this query but not working(though it is working in console)
So right now I am calling apex_util.prepare_url with dummy string say 'report_ID' the result I am passing to a javascript function as an argument. In javascript function, I am extracting the url part of the string(because I need the checksum value) and then replacing the dummy variable with $v("myStaticID_report_id") and then calling apex.navigation.dialog from there.
Now its functional but this needs to be repeated in almost 70 pages in my application. So I want to know if there is a better way to do this.
Thanks in advance

go to the most recent state on clicking the back button

Im building a website using django. On my display page, I have a list of items (with the name results), and I have filters which filter "results" and get another list "filtered" on the display page using an ajax call.
Now when I go to some other page, and then click the back button, I get back to the page with the filters selected, but the results are not filtered (I would want the "filters" list rather than the "results" list on going back). How do I get to the most recent state after using the back button? Basically, everything done using javascript and the subsequent actions get flushed.
Can anyone help me with this. Thanks.
Browser history behavior gets complex, but one technique I've used is to embed the state in the hash. That will make the browser treat each different hash value as a different page in the history, and also lets you do things like bookmark a particular filter selection state. I used jquery, along these lines:
$(function() {
if (window.location.hash) {
// parse the hash and update your filter settings, then get the content and display it
};
function update_hash() {
// calculate the hash based on your filter
window.location.hash = new_hash;
};
};
Then bind update_hash as an event handler for changes.

Passing a text field value into popup page using URL

I am trying to pass the value of a text field from one page to another using the URL but failing miserably.
The reason for this is as follows:
I have an apex page which displays a machines properties (make, model, what products it makes, machine ID (:P1_INPUT)). Some machines can only make one product, other can make a variety.
I use a query to complete the following: If the machine only makes one type of product , the product number is displayed in :P1_item. If a machine can make more than one product it displays in :P1_item the world 'multiple'.
I want to build in the ability to click on a button next to :P1_Item, a popup appears with the products the machine makes if ‘multiple’ is displayed. I have the popup bit working but its not passing my :P1_INPUT from the page to the popup page text field :P3_OUPUT
The following code i have on the button, so when it is clicked, it opens a popup page (this works) and should populate the text field (P3_OUTPUT) with the value passed from P1_INPUT (this doesnt work).
My button is set to Redirect to URL and i have this in the URL target.
javascript:popupURL('f?p=&APP_ID.:HELLOWORLD:&SESSION.:::&P3_OUTPUT.:&P1_INPUT.')
I cant use a branch because i dont want the main page showing the machine properties to submit.
Your URL is wrong: f?p=&APP_ID.:HELLOWORLD:&SESSION.:::&P3_OUTPUT.:&P1_INPUT. : you want to provide a value for the item P3_OUTPUT while you have set &P3_OUTPUT. which is a substitution string and would put the value of P3_OUTPUT in the string.
You need to set the URL to f?p=&APP_ID.:HELLOWORLD:&SESSION.::::P3_OUTPUT:&P1_INPUT., which would correctly set the value of P3_OUTPUT and add an extra semi-colon between the session identifier and the arguments-values pair.

Django: after submiting POST data page opens at a given div id, not at the top of the page

I have a quite long and complicated form which has several submit buttons. When the user clicks a submit button their data is saved but then they are sent back to the top of the page, which is annoying because the user then has to scroll back down to get to the part of the form they were working on.
(The form controls the color and layout of the user's webpage, so the expectation is that the user will make many changes, submitting many times, rather than just filling out the form and submitting once.)
Is there any way to send the user to the correct part of the page (preferably without resorting to Javascript)?
Create an anchor in your page at the correct location:
<a name="section1">Section 1</a>
Then use Django's HttpResponseRedirect and with the anchor specified.
return HttpResponseRedirect('/form#section1')
Haven't tested this myself, but I'm assuming it will work because I've seen a few snippets like this one.