Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » can't get _cm_popupReturn to execute
can't get _cm_popupReturn to execute [message #1222] Mon, 14 January 2008 18:52 Go to next message
ikatz is currently offline  ikatz
Messages: 40
Registered: December 2007
Location: Durham, NH
Member
I'm having trouble working with the _cm_popupReturn function. Specifically, it seems that it is never called.

I am using a popup1 through an add3 to insert rows into a multi2, representing this table:
CREATE TABLE membership_access (
    membership_id INT UNSIGNED NOT NULL,
    person_company_id INT UNSIGNED NOT NULL,
    role_id VARCHAR(20) NOT NULL,
    date_added DATE NOT NULL,

    PRIMARY KEY (membership_id, person_company_id),
    FOREIGN KEY (person_company_id)
        REFERENCES person_company (person_company_id),
    FOREIGN KEY (membership_id) REFERENCES membership (membership_id),
    FOREIGN KEY (role_id) REFERENCES role (role_id)
) Engine=InnoDb;

membership is the outer, membership_access is the inner, and person_company is the popup.

I am using the _cm_popupCall function in classes/membership_access.class.inc to filter the records shown in the person_company popup (and it works). But when I choose the item from the popup, the _cm_popupReturn (which is also in classes/membership_access.class.inc) never fires. Because of this, role_id and date_added are blank -- which gives me an error message at the bottom of the multi2 screen.

My intention is to use _cm_popupReturn in order to provide default values for role_id and date_added. Am I failing because multi2 is unsuited for this purpose, or because I lack some understanding of the program flow (and should be using some other _cm_ function to achieve this result)?
Re: can't get _cm_popupReturn to execute [message #1223 is a reply to message #1222] Mon, 14 January 2008 19:47 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
When you press the CHOOSE button in the POPUP form you need to start your debugger to see what is happening when it returns to the calling form.

Re: can't get _cm_popupReturn to execute [message #1225 is a reply to message #1223] Tue, 15 January 2008 14:04 Go to previous messageGo to next message
ikatz is currently offline  ikatz
Messages: 40
Registered: December 2007
Location: Durham, NH
Member
OK I am looking into that now. I was using the debugger before, but it seems that it was stopping when the popup page's execution got to the HTTP redirect. Now that I'm using the right setting, I'll see what else I can learn about this issue.

In the meantime, where is the best place to put my first breakpoint (i.e., where does the core framework finish loading/initializing and turn over control to one of my classes)?
Re: can't get _cm_popupReturn to execute [message #1226 is a reply to message #1225] Tue, 15 January 2008 14:45 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
If you are using the ZEND debugger (as I am) it is not worth while trying to set a breakpoint at where you think the problem might lie. I always set it to debug every page so that it automatically starts from the beginning of each script, then I step through each line one at a time. It is the only way to see what is truly happening.

Re: can't get _cm_popupReturn to execute [message #1227 is a reply to message #1226] Tue, 15 January 2008 14:51 Go to previous messageGo to next message
ikatz is currently offline  ikatz
Messages: 40
Registered: December 2007
Location: Durham, NH
Member
In that case, can you recommend some of the more useful variables to watch?
Re: can't get _cm_popupReturn to execute [message #1228 is a reply to message #1227] Tue, 15 January 2008 19:27 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
A good place to start would be any variable that is referenced as you step through the execution of the ADD3 form after returning to it from the POPUP. I cannot identify a particular variable or line of code to watch - you have to look for yourself to see what is going on and why.

Re: can't get _cm_popupReturn to execute [message #1229 is a reply to message #1228] Wed, 16 January 2008 15:38 Go to previous messageGo to next message
ikatz is currently offline  ikatz
Messages: 40
Registered: December 2007
Location: Durham, NH
Member
Thanks! That was extremely helpful as a starting point.

I think I found my problem, although I'm not sure what it would suggest as a solution: unlike add1 and add2, std.add3.inc does not make a call to $dbObject->popupReturn. Is there a specific reason for this, or is it just an oversight?

Has a call to popupReturn become part of add3 in a more recent Radicore release? If not, is changing my transaction from multi2 to list2 my best recourse?

(I think that I am using "radicore-2006-04-21". I am not sure what file would tell me the version number or where my predecessor may have put it.)
Re: can't get _cm_popupReturn to execute [message #1230 is a reply to message #1229] Wed, 16 January 2008 17:21 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
If you look inside file RADICORE-yyyy-mm-dd.txt in the top-level directory you will see the version number, which on that date was 1.6.0. This is hopelessly out of date as the current version, with roughly one update per month since then, is now 1.32.0. You really ought to upgrade.

A call to popupReturn is only made in those tasks which accept a single choice. An ADD3 task can accept multiple choices, so there are multiple calls to the insertRecord method. This is described in http://www.tonymarston.net/php-mysql/dialog-types.html#add3. You will therefore have to use one of the custom methods that is referenced in that sequence.


Re: can't get _cm_popupReturn to execute [message #1238 is a reply to message #1230] Thu, 17 January 2008 16:06 Go to previous message
ikatz is currently offline  ikatz
Messages: 40
Registered: December 2007
Location: Durham, NH
Member
OK, I was able to fix this by moving to a list2 transaction. I am still getting the hang of where field names (real and virtual) come from, but I will start another thread for that.

I will attempt to upgrade after I get more familiar with this system.

Thanks
Previous Topic: Delete2 deletes the wrong records... where's my error?
Next Topic: hyperlink in list or detail or tree form
Goto Forum:
  


Current Time: Thu Apr 18 21:04:05 EDT 2024

Total time taken to generate the page: 0.01181 seconds