did you put something like <?php echo $content_for_layout ?> in your
"empty" layout?
senser schrieb:
> Hi,
>
> I work on application based on CakePHP and use ajaxHelper in one of my
> forms for updating field (i've tried text_field, taxtarea_field,
> block .... etc but same result) according to select_box change. I want
> to show an address of a selected employer - employers list is in a
> populated select box and when user select an employer I want the
> address to be shown below select_box.
> Here is snippets from the code:
>
> /*******Layout of the form*****************/
>
> print $form->input('CustomerTaxDetail.employers_id',
> array('type'=>'select', 'label'=>'Employer', 'options'=>
> $employersArray, 'showEmpty'=>false, 'size'=>4,
> id'=>'employers','error'=>array('required'=>'Employer is obligatory',
> 'maxlength'=>'Employer code max length is 8 symbols',
> 'number'=>'Employer code must be a number')));
>
> print '<div id="employer_address"> </div>';
>
> print $ajax->observeField('employers', array('url'=>'/employers/
> update_address', 'update'=>'employer_address',
> 'loading'=>'document.getElementById(\'employer_address
> \').style.display=\'block\'',
> 'loaded'=>'document.getElementById(\'employer_address\').style.display=
> \'block\''));
>
> /********End of layout*********************/
>
> /****update_address function in EmployerController where I get the
> employer address******/
>
> function update_address() {
> $this->Employer->recursive=0;
> if(!empty($this->data['CustomerTaxDetail']['employers_id'])) {
> $employer_id = (int)$this->data['CustomerTaxDetail']
> ['employers_id'];
>
> $this->set('address',$this->Employer->read('Employer.address',
> $employer_id));
> }
> }
>
> /********End of function*********************/
>
> /**********The View for update_address function*************/
>
> <?php
> if(!empty($address)) {
> print $address['Employer']['address'];
> }
>
> /************Enf of the View***************/
>
>
> So the problem is that when I select an emploer from select_list and
> the field below is populated with whole html of the default layout I'm
> using and not only with employer's address. I've tried to make an
> empty layout and use it in function update_address but then the box
> for the employer_address stays empty.
>
> Finally my question is how to populate employer_address field only
> with the address but not with whole layout/html.
>
> Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---