On Tue, Sep 21, 2010 at 9:25 PM, Daniel M.K. <[email protected]> wrote: > What i want to do as title says is to fetch data from database while > i'm filling in a form, data will be introduced. > > I.E: I have 5 Tournaments with 5 schedules and 200 teams each one with > 5 schedules too, so i just want to fetch the data when selecting one > of the five tournaments to get the list of the 200 teams, select one > team and then retrieve data from that team and display it in the form > in some fields (I.E: Name, Place, Schedule, etc..)
You mean that you want to fetch it with an AJAX call, without reloading the page? Search for "cakephp ajax select". Precisely how you go about it depends on whether and what kind of javascript framework you're using, and whether you use Cake's AjaxHelper. But the general idea is that you assign a JS function to the onchange event of your select list. This function makes an AJAX call to your controller method, passing the option value (usually an id). The controller method fetches the data,sets debug to 0, sets the layout to 'ajax', an renders the view. The view itself can either have a full select list with options, or just the options. It depends on how your JS function handles the data. It can either create the new select list completely, or replace the list of options. Something like that. 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
