internetchris wrote: > I come from a Visual Foxpro background and when I would want to add a > button to a form I could simply place it on the form and then modify > the clickevent with my custom code for that button.
What's primarily tripping you up in your thinking has to do with the difference between event-driven vs. request-response driven systems. Foxpro is an event-driven system where an event loop constantly runs. The loop monitors an event queue and responds to those events as they arrive. This is not the case with web based applications, regardless of the framework used to build them (apart from AJAX that is). Web applications work on a request-response cycle: 1. A user requests a form (GET /accounts/new) 2. The server responds with HTML representing the account form 3. The server continues processing other requests ... time passes 4. The user submits the form (POST /accounts) 5. Rails routing system associates the request based on the HTTP method (POST) and URL (/accounts) 6. Rails calls the "create" method of accounts_controller 7. Server response with HTML depending on the "create" action. 8. Server waits for another request. This is also referred to as "stateless" communication. That's how the web was designed. The notion of state was added onto HTTP later by using cookies and other methods of identifying user state. Rather than thinking of the button as "having an event" it's really the form itself that has the event (technically the "action" of the form). The button is just a visual widget to provide the user a way to submit the form. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

