2002 Posts in 1422 Topics by 616 members
|Go to End|
10 May 2012 at 11:28am
I need some assistance with using a HasManyComplexTableField on a basic form. I have a tabbed form that holds information about a client. The client has many addresses. I am using a HasManyComplexTableField to enter addresses that belong to the client. For the life of us, my coding partner and I have not be able to figure out how to accomplish this.
The main problem is that when an address is saved, I would like the ClientID to be written to the Address table. I have tried many different ways to set the ClientID manually in the Addresses popup form. For example, I have used fieldset->push() to add it as a hidden field to the fieldset passed to the HasManyCTF to set appropriate ClientID that way. However, the value is often not preserved in the generated Addresses form.
The form itself subclasses Page. If I create a has_one relationship to Client and a has_many to Addresses, I do get a drop down list in Addresses which allows me to select the right client. However, this is a front-end form and I would like the correct client to be automatically selected. The client that should automatically be associated with the Address HasManyCTF is evidently the one then loaded into the parent form.
If have also tried using the replaceWith method on the FieldSet object to replace the DropDown ClientID field with a hidden one. However, the value comes through as empty which results in the address being saved with a ClientID of 0.
Can anyone suggest a way to have the parent and child HasManyCTF synchronized so that when the HasMany is saved it automatically writes the correct ClientID without this having to be set by the user then entering the data?
This seems like a pretty ordinary use case so I think there must be something very basic I am missing.
Happy to post code excerpts if this will help.
Thanks in advance for your help. Have been stumped by this for several days now.
11 May 2012 at 7:30am
Anyone reading this forum who knows about HasManyCTF???
|Go to Top|