not saving associated data...

thread: 11 messages  |  last: a year ago  |  started: monday, march 15, 2010, 11:31 am pdt


#1  |  kingwithin (San Francisco, CA) United States of America
Monday, March 15, 2010, 11:31 AM PDT

Hi,

I have a profile for User and user Details is an associated table.

I seem to be able to get it to work in one part of the application by doing the following:


protected function btnSave_Click($strFormId, $strControlId, $strParameter) {

        $this->objUser->UserDetail->BackupEmail = $this->txtBackupEmail->Text;
        $this->objUser->UserDetail->Title = $this->txtTitle->Text;
        $this->objUser->UserDetail->City = $this->txtCity->Text;

        $this->objUser->UserDetail->Save();
        $this->objUser->Save();
}

I excerpted some things out from this controller for the button but I believe these are the essentials.

I have another application which is a “popup” in a lightbox but I assume it should still work:

        $this->objUserDetails->LName = $this->txtLastName->Text;    
        $this->objUserDetails->Title = $this->txtTitle->Text;    
        $this->objUserDetails->City = $this->txtCity->Text;
        $this->objUser->AccountIdObject->Name = $this->txtCompany->Text; 
        $this->objUserDetails->Save();
        $this->objUser->Save();

IN this case I have:

        $this->objUserDetails = UserDetails::LoadById($this->objUser->UserDetailId);

Yes, I did use the same objUser->UserDetail and that didn't work either.

Thoughts?

#2  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Monday, March 15, 2010, 2:10 PM PDT

are you sure you action is being called on your save event?

The simplest way to verify this is to do an “exit('i am here');” in your save event right before you make your call to $objUserDetail->Save() on the data object.

If that works, then make sure the data in the userdetail object is what should be as expected.  You can do this by doing something like “exit(var_dump($objUserDetail));” right before you make your call to $objUserDetail->Save().

#3  |  kingwithin (San Francisco, CA) United States of America
Wednesday, March 17, 2010, 10:35 AM PDT

Hmm, so I put the exit('am here'); and nothing happens....!

However, on the development local box it works.

How else can I drill into what's wrong?

#4  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Thursday, March 18, 2010, 9:05 AM PDT

Any javascript errors show up (e.g. in firebug or in firefox webdev toolbar?)

How about if you place the exit('here') right at the beginning of your click handler method?

#5  |  kingwithin (San Francisco, CA) United States of America
Thursday, March 18, 2010, 3:18 PM PDT

Hi,

I didn't see any errors in the post, there was an odd error:

objEvent.target.nodeName is undefined
[Break on this error] if ((objEvent.target.nodeName.toLo...et.nodeName.toLowerCase() == 'span'))

This is in the control_dialog.js (?)

#6  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Thursday, March 18, 2010, 3:44 PM PDT

Which environments do you get that -- in your prod only?  Or both in dev and prod?

#7  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Thursday, March 18, 2010, 3:44 PM PDT

What are teh differences in environment settings between your dev and prod?

#8  |  kingwithin (San Francisco, CA) United States of America
Thursday, March 18, 2010, 9:07 PM PDT

Hi, well the biggest difference is that locally is windows and the staging environment is linux on sun boxes.....

the con....hmmmm....offfiguration.inc.php values are essentialy the same I believe except for backslashes, the database, and .htaccess sets the path hmmm...other than that, I basically just take the SVN version that works locally and do a force update to the staging server.....

The weird thing thing is that I, in another part of the app, do successfully save the associated data easily.

Thoughts....?

#9  |  kentpachi (France, EU) France
Saturday, March 20, 2010, 3:43 AM PDT

Make sur you don't have any custom <form> tag in this page.

Also, what do you mean by popup. Is a dialogbox ? or ?

#10  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Saturday, March 20, 2010, 10:56 PM PDT

What do you mean by “except the backslashes”?



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.