So I can basically place "if" statements in the action based upon the identification of the submit button right? That seems pretty easy although I could see how this might be messy if a user has filled out another part of the form and you want to make sure that information is either saved prior to them using another type of submit button. Can all of this be circumvented using ajax within the form? With the use of Ajax can I submit a single call to an action without worrying about anything else on that form?
Thanks Chris On Sep 3, 1:15 am, Colin Law <[email protected]> wrote: > 2009/9/3 Marnen Laibow-Koser <[email protected]>: > > > > > > > > > internetchris wrote: > >> Robert, that was a great explanation! I appreciate all of the other > >> replies too. A couple more question to make sure I understand > >> correctly... > > >> So in all honesty this little button doesn't have much to do with the > >> overall process, but it makes it easier for the user to see the last > >> account number used so they can assign the next available account when > >> submitting new records. > > > The user should probably not be assigning account numbers. That's a job > > for the DB. > > >> New records will be infrequent so the idea > >> that more than one user is posting them is probably unlikely but still > >> possible. I can check for this prior to saving the record. > > > Just avoid the problem entirely by letting the DB supply the number! > > >> Robert, to make sure I understand what you are saying let me summarize > >> my understanding... > > >> The form submission "in it's entirety" is considered the "event" - the > >> only way to provide the user with information like what I want to do > >> is either when the page loads, via a refresh (Post) of some sort, or a > >> tricky ajax event. It's not possible to call little events via buttons > >> or forms when dealing with a web application unless I use ajax - is > >> that correct? > > > Not quite. You can have as many forms or links to controller actions as > > you like on a given page. However, absent JavaScript, each form can > > only have one submit action. > > Just a small clarification on this, each form can have only one submit > _action_ but it can have multiple buttons that call the action. So > you can, for example have two buttons labelled Do it and Cancel using > <%= submit_tag "Do it" %> > <%= submit_tag "Cancel" %> > and then in the action determine which button was pressed by examining > params[:commit] > > Colin > > > > > > >> I really appreciate the help - this is something I have been grappling > >> with in my brain. It's simply a hold over from how I learned to > >> program - for better or worse. > > >> Thanks! > > >> Chris > > > Best, > > -- > > Marnen Laibow-Koser > >http://www.marnen.org > > [email protected] > > -- > > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---

