Use a popup from a navigation button [message #1824] |
Wed, 12 November 2008 10:35 |
gpatti
Messages: 283 Registered: August 2008
|
Senior Member |
|
|
I am trying to achieve the following functionality using a popup form:
From a standard LIST2 screen I have a navigation button 'Print Letter'. This activates a popup form detailing the documents that are available to be printed, and I want the user to be able to choose one, and then control will be passed to the appropriate output task for the letter selected.
I was expecting to use _cm_popupReturn to code this. However I am not sure that the popup functionality is working in the way I expected and think this is because I am not associating the popup to a field as would normally be the case. _cm_popupReturn does not seem to be executed (I tried following through with a debugger but couldn't easily find where I am going wrong, so asking for advice instead).
If a popup cannot be used in this way is there another way I could achieve this type of functionality? I thought of just using a LIST1 transaction, but this would not give the CHOOSE option for a user to select.
|
|
|
|
|
Re: Use a popup from a navigation button [message #1833 is a reply to message #1832] |
Thu, 13 November 2008 13:40 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
When the initial passthru option is used the passthru task is activated without going through any preprocessing which depends on the task's pattern_id, therefore it will not perform any popupCall() processing. This in turn means that when the passthru task terminates and the parent task is reactivated the parent task does not know about the popup form and cannot perform any popupReturn() processing. The selection from the popup is made available in the $where string and can be processed in the _cm_initialise() method.
Another point - do not use the UPDATE3 pattern for your parent task as this has a highly specialised purpose. You can use an UPDATE1 pattern if you want a task with a SUBMIT button. If you don't change any database values then no database update will be performed.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
|
|
|
|
|
|
Re: Use a popup from a navigation button [message #1870 is a reply to message #1869] |
Fri, 21 November 2008 17:56 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
It is possible for a popup to return to a task that does not have a screen, as shown in the ADD3 pattern. When the task has finished processing the selection passed back to it by the popup it simply exits and returns control to its parent task by calling the scriptPrevious() function.
I suggest you step through with your debugger to see exactly what is happening.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Use a popup from a navigation button [message #1874 is a reply to message #1873] |
Sun, 23 November 2008 16:46 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The output2 task ends with the following code:
if (!eregi('(D|I)', $destination) OR !empty($errors)) {
scriptPrevious($errors, $messages);
} else {
unset($_SESSION['pages'][getSelf()]); // delete current script from session array
} // if
which means that the scriptPrevious() function is only executed when the value of $destination is not 'D' or 'I'. What value do you have?
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
|
Re: Use a popup from a navigation button [message #1878 is a reply to message #1877] |
Sun, 23 November 2008 17:54 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
I think the problem arises because you are not using the popup form in the way it was designed to be used. It it supposed to be called from a popup button, not a navigation button or a passthru task.
If I understand your problem correctly you are starting with a LIST2 task in which you make a selection, then you want to press a button in order to print a letter for that selection.
You are trying to have a single task which prints that letter, but because there are several types of letter you want another mechanism where the user can choose the letter type before it is printed.
Why don't you have a separate task for each type of letter, then a separate navigation button for each of those tasks?
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Use a popup from a navigation button [message #1880 is a reply to message #1879] |
Sun, 23 November 2008 19:39 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
How about having the LIST2 task pass its selection to an UPDATE1 task (which has a SUBMIT button), and this UPDATE1 task has a dropdown list from which the user can choose a letter type. When the user presses the SUBMT button it does not update the database, but instead passes the LIST2 selection and the letter type from the dropdown list to another task which performs the printing.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Use a popup from a navigation button [message #1882 is a reply to message #1881] |
Mon, 24 November 2008 05:25 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
What do you mean by "I want to run the task without having preselections mandatory"?
Quote: | The upd1 task will not run if I have not made a selection
|
In that case change from UPDATE1 to ADD2. If nothing is selected in the LIST2 task then the $where variable in the ADD2 will contain the WHERE string used by the outer/parent entity of the LIST2 task.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|