Perhaps  I didn't look at your code very closely, but after you've
made the xml string ($xml) what happens? Shouldn't your action output
(return) that xml?
I'm not sure if 1.1 has the ability to use RequestHandler to respond
as xml, otherwise you could just make an empty layout, which would
only display your xml data (or more specifically return your xml data
back to jquery).

p.s. do you really need 'onchange' in your select tag? I'm pretty sure
with jquery you can "listen" for an event on a given element.

On Sep 17, 8:34 pm, peterhf <[EMAIL PROTECTED]> wrote:
> Using:
> CakePHP 1.1.19.6305
> jquery-1.2.6.min.js
>
> In the view:
>
> <tr><td align="right" class="label_14" width="200px">select a
> campaign:&nbsp;</td><td align="left"><?php echo $html->selectTag( 
> 'Campaign/CampaignID', $options_C, null, array( 'onchange'
>
> => 'display_select_event()','id' => 'select_campaign' ), null, true,
> false ); ?></td></tr>
>
> In the JavaScript:
>
> function display_select_event()
> {
>   .
>   .
>   .
>   // get the events for this campaign.
>   $.get( 'Attendance/get_events', { campaign_id: selected_index },
> function( xml ) { alert( xml  ); }, 'XML' );
>   .
>   .
>   .
>
> }
>
> In the controller:
>
>   function get_events( $campaign_id )
>   {
>     $conditions = array( 'CampaignID' => $campaign_id );
>     $fields = array( 'CEventID', 'Name' );
>     $result = $this->Event->findAll( $conditions, $fields, null, null,
> 1, null );
>
>     if( count( $result ) )
>     {
>       $xml = '<?xml version=\"1.0\" standalone=\"yes\"?>';
>
>       foreach( $result as $key => $value )
>       {
>         foreach( $value as $id => $name )
>         $xml .= '<event>';
>         $xml .= '<id>' . $value['Event']['CEventID'] . '</id>';
>         $xml .= '<name>' . $value['Event']['Name'] . '</name>';
>         $xml .= '</event>';
>       }
>     }
>     else
>     {
>       // What if there are no events for this campaign.
>     }
>   }
>
> The function, get_events(), produces the correct, well-formed XML
> document. But Cake is complaining about the missing view for
> "get_event" and the jQuery is not returning the XML document produced
> by get_events().
>
> A link to an example of what I am trying to do would be sufficient and
> greatly appreciated but if you spot the errors in my code that would
> be appreciated also.
>
> Peter -
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to