i get it Follow the LANGDON code,
On VIEW, the main SELECT: <?php echo $html->selectTag('Animal/animal_type_id', $AnimalTypeArray, $html->tagValue('Animal/anima_Typel_id'), array());?> Where $animalTypeArray is a generatedList() in function add() in controller and <?php echo $ajax->observeField('AnimalTypeAnimalId', array('frequency' => '1','url' => '/Animais/FindRace/', 'update' => 'box')); ?> <div id="box"></div> On CONTROLLERi put : function FindRace() { $this->set('raceArray', $this->Animal->Race- >generateList(array('animal_type_id' =>$this->data['Animal'] ['animal_type_id']),"nome ASC",null,"{n}.Race.id","{n}.Race.nome")); } So... ANOTHER VIEW the i have to create the template for the function findRace( find_race.thtml ) <?php echo $html->selectTag('Animal/race_id', $racaArray, $html- >tagValue('Animal/race_id'), array());?> Thx For all Bye On 2 mar, 16:51, "fredBH" <[EMAIL PROTECTED]> wrote: > oh god... i still can understand it... > > how is code int controller ? > > thx for u attetion > :) > > On 17 fev, 03:57, Langdon Stevenson <[EMAIL PROTECTED]> wrote: > > > 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 cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---