Hi, I am having a fair amount of success with ModalBox after playing around with it for a couple of days.
http://www.wildbit.com/labs/modalbox/ My reason for wanting to use modal windows in my app is that the following models can all have unlimited Telephone Numbers Organisation, Person, Scheme, Agency, Household, Staff, Client, Agency Contact When viewing any of the above model's records, I want to be able to manage telephone numbers within a modal window so I can then add, edit, delete any amount of numbers before closing the window which will then refresh the parent page with it's updated list of numbers. So far I am opening the modal window fine, managing to handle multiple Ajax calls within that window, then closing the window and reloading the main page without issue. The main problem I face is managing the state of variables and this is most notable when adding/editing a record. After opening the modal window and clicking the 'add' link I am presented with a form as expected. I fill int eh form and submit the data and the index action shows me a list including my new number. If I then click on 'add' again it skips displaying the form and adds another number with the same details as entered for the previously added number. My add function looks like function add($parent_model = null, $parent_id = null) { if (!$this->__errorCheck($parent_model, $parent_id)) return; if (!empty($this->data)) { echo debug($this->data); $this->TelephonyNumber->create(); $this->data['TelephonyNumber']['creator_id'] = $this->authUser ['User']['id']; $this->data['TelephonyNumber']['modifier_id'] = $this->authUser ['User']['id']; if ($this->TelephonyNumber->save($this->data)) { $this->Session->setFlash('Telephony number added.'); } else { $this->Session->setFlash('Whoops, telephony number not added!'); } unset($_POST); unset($this->data); $this->setAction('index', $parent_model, $parent_id); return; } $this->data['TelephonyNumber']['parent_model'] = $parent_model; $this->data['TelephonyNumber']['parent_id'] = $parent_id; $this->data['Parent'] = $this->__parentVars($parent_model, $parent_id); } As you can see I am trying to unset() the $this->data and $_POST arrays after a new number is added but this data is obviously being stored elsewhere ... any ideas? Thanks, Paul. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
