Re: Ajax question -- Updating multiple divs

2009-06-20 Thread schneimi

Hi Nancy,

I think what you want to do is not possible with observeField.

But you could easily implement such a function as a own helper
function that internally generates your current ajax calls.

Regards,

Michael

Nancy schrieb:
> Ok, I've got one select list that needs to drive the contents of two
> other select boxes.  I understand how to use observeField and
> apparently I can update multiple divs.  My question is, do I have to
> do it from only one controller action or can more than one controller
> be used?  It's just weird because the data comes from two different
> tables and you wouldn't ordinarily access from the same controller.
>
> Here's my current Ajax calls:
>
> echo $ajax->observeField('DeviceDgtypeId', array(
> 'url' => '/subtypelists/getSubtypelists',
> 'update' => 'DeviceSubtypelistId',
> )
> );
> echo $ajax->observeField('DeviceDgtypeId', array(
> 'url' => '/cells/getCellsByDgid',
> 'update' => 'DeviceCellId',
> )
> );
>
> So... in a perfect world I'd probably want to do this:
> echo $ajax->observeField('DeviceDgtypeId', array(
> 'url' => array('/cells/getCellsByDgid', "/subtypelists/
> getSubtypelists"),
> 'update' => array('DeviceCellId',"DeviceSubtypelistId"),
> )
> );
>
> But that doesn't seem to work.  So I'm assuming it has to come from
> one controller.
>
> So if I have to return two sets of data from one controller, how do I
> render it so that the observeField knows which data goes to which div?
>
> I'm so confused!
>
> Thanks :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ajax question -- Updating multiple divs

2009-06-19 Thread Nancy

Ok, I've got one select list that needs to drive the contents of two
other select boxes.  I understand how to use observeField and
apparently I can update multiple divs.  My question is, do I have to
do it from only one controller action or can more than one controller
be used?  It's just weird because the data comes from two different
tables and you wouldn't ordinarily access from the same controller.

Here's my current Ajax calls:

echo $ajax->observeField('DeviceDgtypeId', array(
'url' => '/subtypelists/getSubtypelists',
'update' => 'DeviceSubtypelistId',
)
);
echo $ajax->observeField('DeviceDgtypeId', array(
'url' => '/cells/getCellsByDgid',
'update' => 'DeviceCellId',
)
);

So... in a perfect world I'd probably want to do this:
echo $ajax->observeField('DeviceDgtypeId', array(
'url' => array('/cells/getCellsByDgid', "/subtypelists/
getSubtypelists"),
'update' => array('DeviceCellId',"DeviceSubtypelistId"),
)
);

But that doesn't seem to work.  So I'm assuming it has to come from
one controller.

So if I have to return two sets of data from one controller, how do I
render it so that the observeField knows which data goes to which div?

I'm so confused!

Thanks :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---