I suggest you use the Log to write out some debug information, to make
sure that you work with the correct information.
For example in the populate_document_select function I would do
something like this:

[code]
function populate_document_select() {
   $this->log($this->data['Document'], 'ajax_debug_log');
   $this->log($this->params, 'ajax_debug_log');
...
}
[/code]

Then look in the app/tmp/log directory for the log file and
investigate the data there, whether they conform to your expected
content.
Enjoy,
   John

On May 12, 4:18 am, aveev <[email protected]> wrote:
> Sorry, the code I wrote should be like this, but it still doesn't work
> test_ajax.ctp
> <?
>         echo $form->create('');
> echo
> $form->select('document_type_id',array($docTypes),null,array('id'=>'document'),true);
>     
>         echo $form->input('document_number', array('id'=>'docnum'));
>
> $ajax->observeField('document',array('url'=>'populate_document_select','update'=>'docnum'));
>         echo
> $ajax->observeField('document',array('url'=>'populate_document_select','update'=>'docnum'));
>         echo $form->end('Save');
>
> ?>
>
> DocumentsController
> function populate_document_select() {
>           if(!empty($this->data['Document']['document_type_id'])) {
>                 $options = 
> $this->getList($this->data['Document']['document_type_id']);
>             $this->set('options', $options);
>
>           }
>         }
>
> function getlist($document_type_id=null) {
>
>                         $doc =
> $this->Document->find('first',array('conditions'=>array('Document.document_type_id'=>$document_type_id,'status'=>'new'),
> 'fields'=>(array('Document.document_number'))));
>
>                         return $doc['Document']['document_number'];
>
>         }
> populate_document_select.ctp
> <?php
> if (!empty($options)) {
>   echo $form->input('document_number', array('id'=>'docnum',
> 'value'=>$options));}
>
> ?>
[snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to