Hi, Can anyone tell me how do I get form id and print it out puts ? Thanks -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
user splash wrote:> Hi, > > Can anyone tell me how do I get form id and print it out puts ? > > ThanksStep 1: Rephrase your question and be more specific. Step 2: Receive Help. Step 3: Rejoice. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Although this may seem a bit harsh to start with, I think Phil Tayo is right. user splash, please be more elaborate with your questions. The more detail you give us, the more likely we are to help you. On Jan 23, 2008 7:15 AM, Phil Tayo <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > user splash wrote: > > Hi, > > > > Can anyone tell me how do I get form id and print it out puts ? > > > > Thanks > > Step 1: Rephrase your question and be more specific. > Step 2: Receive Help. > Step 3: Rejoice. > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> Although this may seem a bit harsh to start with, I think Phil Tayo is > right. user splash, please be more elaborate with your questions. The > more > detail you give us, the more likely we are to help you. > > On Jan 23, 2008 7:15 AM, Phil Tayo <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > >> Step 3: Rejoice. >> -- >> Posted via http://www.ruby-forum.com/. >> >> >Hi, What I want to ask is if it is possible to get the id of a form, assign it to something like :id_of_form, then print it out using puts params[:id_of_form] Thanks -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
hmmm still not 100% sure what you mean....does this example help? If you had a file called register.rhtml and a model called user.... <% form_for :user do |form| %> <div class = "form_row"> <label for="screen_name">Screen name:</label> <%=form.text_field :screen_name%> </div> <div class = "form_row"> <%=submit_tag "Register!", :class => "submit" %> </div> <% end %> In the controller in the "register" method (I think ruby takes the controller method name from the name of the .rhtml file) you can then receive the form using "params[:user]" and then do @user = User.new(params[:user]) to create a new user.... Does this help? Or am I off track? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Phil Tayo wrote:> hmmm still not 100% sure what you mean....does this example help? > > If you had a file called register.rhtml and a model called user.... > > <% form_for :user do |form| %> > > <div class = "form_row"> > <label for="screen_name">Screen name:</label> > <%=form.text_field :screen_name%> > </div> > > <div class = "form_row"> > <%=submit_tag "Register!", :class => "submit" %> > </div> > > <% end %> > > In the controller in the "register" method (I think ruby takes the > controller method name from the name of the .rhtml file) you can then > receive the form using "params[:user]" and then do @user = > User.new(params[:user]) to create a new user.... > > Does this help? Or am I off track?Hmm....Sorry if my question is not clear. What I was trying to do is to get the form''s id, and try to submit it using a link outside the form. Example: <% form_for :user, :url => { :action => :save_user}, :html => { :id => "id_of_form" } do |form| %> <div class = "form_row"> <label for="screen_name">Screen name:</label> <%=form.text_field :screen_name%> </div> <%= end %> <%=link_to_function "Save", "myform.submit();" %> I want to ask is there anyway to get id_of_form which is the form''s id ? Correct me if any part of my code is wrong. Is it possible to submit form with the submit link outside of the form? Thanks -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <%= end %> > > <%=link_to_function "Save", "myform.submit();" %> > > > > I want to ask is there anyway to get id_of_form which is the form''s id ? > Correct me if any part of my code is wrong. Is it possible to submit > form with the submit link outside of the form? > > Thankshmm how about: <%=link_to "Save", {:action => "save", :form_id => "user"} %> does that work? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
the answer may well be yes buy you can just put an extra hidden input tag in the form like: <input type="hidden name="formid" value="1"> and access it via params[:formid] Adam On 23/01/2008, at 9:42 PM, Phil Tayo wrote:> > >> <%= end %> >> >> <%=link_to_function "Save", "myform.submit();" %> >> >> >> >> I want to ask is there anyway to get id_of_form which is the form''s >> id ? >> Correct me if any part of my code is wrong. Is it possible to submit >> form with the submit link outside of the form? >> >> Thanks > > hmm how about: > > <%=link_to "Save", {:action => "save", :form_id => "user"} %> > > does that work? > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Adam Jones wrote:> the answer may well be yes buy you can just put an extra hidden input > tag in the form like: > <input type="hidden name="formid" value="1"> > and access it via params[:formid] > > AdamHi, Just to make sure, where should I put this hidden field ? I tried placing it in my side bar but can''t get value Thanks -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
user splash wrote:> Adam Jones wrote: >> the answer may well be yes buy you can just put an extra hidden input >> tag in the form like: >> <input type="hidden name="formid" value="1"> >> and access it via params[:formid] >> >> Adam > > > > Hi, > > Just to make sure, where should I put this hidden field ? I tried > placing it in my side bar but can''t get value > > Thankshe''s missed a quote mark off ...it should be: <input type="hidden" name="formid" value="1"> note the second quote mark after hidden -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
sorry also forgot to close the tag... its: <input type="hidden" name="formid" value="1"/> .....put this hidden field anywhere between <form > and </form> for the form you want to reference On 23/01/2008, at 10:41 PM, Phil Tayo wrote:> > user splash wrote: >> Adam Jones wrote: >>> the answer may well be yes buy you can just put an extra hidden >>> input >>> tag in the form like: >>> <input type="hidden name="formid" value="1"> >>> and access it via params[:formid] >>> >>> Adam >> >> >> >> Hi, >> >> Just to make sure, where should I put this hidden field ? I tried >> placing it in my side bar but can''t get value >> >> Thanks > > he''s missed a quote mark off ...it should be: > > <input type="hidden" name="formid" value="1"> > > note the second quote mark after hidden > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<%= hidden_field_tag "name", "value" %> On Jan 23, 2008 8:19 PM, Adam Jones <adam-K36Kqf6HJK7JKwlM9GxbOw@public.gmane.org> wrote:> > sorry also forgot to close the tag... > its: > > <input type="hidden" name="formid" value="1"/> > > .....put this hidden field anywhere between <form > and </form> for > the form you want to reference > > > On 23/01/2008, at 10:41 PM, Phil Tayo wrote: > > > > > user splash wrote: > >> Adam Jones wrote: > >>> the answer may well be yes buy you can just put an extra hidden > >>> input > >>> tag in the form like: > >>> <input type="hidden name="formid" value="1"> > >>> and access it via params[:formid] > >>> > >>> Adam > >> > >> > >> > >> Hi, > >> > >> Just to make sure, where should I put this hidden field ? I tried > >> placing it in my side bar but can''t get value > >> > >> Thanks > > > > he''s missed a quote mark off ...it should be: > > > > <input type="hidden" name="formid" value="1"> > > > > note the second quote mark after hidden > > -- > > Posted via http://www.ruby-forum.com/. > > > > > > > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---