Hi NOSLOW

The most important part of the code that I use is pasted below.  It 
comes from the view file


1.
------
This bit renders the select tag that we want to monitor.  It's just a 
standard select tag.

<?php
   echo $html->selectTag(
     'Batch/lot_number_type',
     $lotNumberTypes,
     null,
     array(),
     array(),
     true
   );
?>


2.
------
This is the target that the new select tag will go into:

<div id="box"></div>


3.
------
This is the observer that watches for a change in the first select tag. 
  When it sees a change it:

- Calls the 'url' listed below
- Which returns a rendered select tag
   (that is just a regular Cake view with no layout)
- Updates the contents of div named 'box' with the returned select tag

<?php   
   echo $ajax->observeField(
     'BatchLotNumberType',
     array(
       'frequency' => '1',
       'url' => '/batches/get_lot_nos/',
       'update' => 'box'
     )
   );
?>

------

Nate's approach that he posted a link to looks like it might be the 
cleaner faster approach, but I haven't sat down and worked out exactly 
how it works yet.

The above code works ok, and you can improve it with the various Options 
that the ajax helper offers.

Hope that this is useful.

Regards,
Langdon



NOSLOW wrote:
> Langdon,
> 
> Any chance that you can post some code snippets of the key pieces of
> the view and controller code? I plan on enhancing the UI of my web app
> with AJAX, but first I'm building the app without it. However, I may
> sneak in a preview of what that might look like as a teaser for my
> team members if it's fairly painless. I need to stay focused on the
> core development for now, so seeing actual code would be extremely
> helpful before I start playing with it.
> 
> Thanks,
> NOSLOW

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to