I am new to ruby on rails.i need to create a page with a question and multiple choice answers with radio button to answer .i ve stored the database in a table with one column ha the question and the other four with answers. i ve to populate the fifth column with the answer selected with the radio button. is this way approprite for me to go and please to guide how to create the radio buttons and how to populate the fifth column with the selected answer. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 24 November 2011 12:44, Guru R. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I am new to ruby on rails.i need to create a page with a question and > multiple choice answers with radio button to answer .i ve stored the > database in a table with one column ha the question and the other four > with answers. i ve to populate the fifth column with the answer selected > with the radio button. is this way approprite for me to go and please to > guide how to create the radio buttons and how to populate the fifth > column with the selected answer.I suggest you work through some rails tutorials to show you the basics of rails. railstutorial.org is good and is free to use online. There are others. Make sure that the tutorial is for the version of rails that you have installed, which should be 3.1. Also look at the Railscasts and Rails Guides. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Nov 24, 6:44 am, "Guru R." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I am new to ruby on rails.i need to create a page with a question and > multiple choice answers with radio button to answer .i ve stored the > database in a table with one column ha the question and the other four > with answers. i ve to populate the fifth column with the answer selected > with the radio button. is this way approprite for me to go and please to > guide how to create the radio buttons and how to populate the fifth > column with the selected answer. > > -- > Posted viahttp://www.ruby-forum.com/.I do not think the structure you described will accomplish what you want. Capturing the selected answer in the same table row as the question will mean the survey can only have one participant, as subsequent answer selections would overwrite the previous answer. You will likely want to create a survey table, user table, and a user_survey table that captures each participant''s selections. The surveys will have many user through the user_survey relationship and the same for users if they can participate in multiple surveys. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
CavalryJim wrote in post #1033545:> On Nov 24, 6:44am, "Guru R." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> I am new to ruby on rails.i need to create a page with a question and >> multiple choice answers with radio button to answer .i ve stored the >> database in a table with one column ha the question and the other four >> with answers. i ve to populate the fifth column with the answer selected >> with the radio button. is this way approprite for me to go and please to >> guide how to create the radio buttons and how to populate the fifth >> column with the selected answer. >> >> -- >> Posted viahttp://www.ruby-forum.com/. > > I do not think the structure you described will accomplish what you > want. Capturing the selected answer in the same table row as the > question will mean the survey can only have one participant, as > subsequent answer selections would overwrite the previous answer. You > will likely want to create a survey table, user table, and a > user_survey table that captures each participant''s selections. The > surveys will have many user through the user_survey relationship and > the same for users if they can participate in multiple surveys.hi calvin thank you for ur reply i ve changed my design such that the selected answer does not get saved in the database.i decided to compare the input from the radio button to the correct answer and store the scores in the session level varaible. but i m not able to read the radio buttons input with the params[:query] in the same view where the radio button is designed.where shold this params[:query] be used. if it has to be used in the controller how can it be called. if there a special kind of form_tag for the radio buttons getting the input ion a session level [variable] -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hi i m new to rails and i m facinga problem with radio buttons. i need to create a portal with multiple choice question. i m using html here. once i submit the answer the page is getting refreshed and the selected radio button is also refreshed. and is show a page with no radio button selected. <form> <br> <input type="radio" name="radios1" onclick="this.parentNode.submit();" value="<%=@abc.a%>"><%=@abc.a %><br> <input type="radio" name="radios1" onclick="this.parentNode.submit();" value="<%=@abc.b%>"><%=@abc.b%> <br> <input type="radio" name="radios1" onclick="this.parentNode.submit();" value="<%=@abc.c%>"><%=@abc.c%> <br> <input type="radio" name="radios1" onclick="this.parentNode.submit();" value="<%=@abc.d%>"><%=@abc.d%> <br> <br> <br> <br> <input type="submit"> </form> please do give me a solution for this -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 13, 2011, at 1:11 AM, Reva wrote:> hi > i m new to rails and i m facinga problem with radio buttons. i need to > create a portal with multiple choice question. i m using html here. > once i submit the answer the page is getting refreshed and the > selected radio button is also refreshed. and is show a page with no > radio button selected.The page is going through a submit/refresh cycle, and that does re-set the form elements to their default.> > <form> > <br> > <input type="radio" name="radios1" > onclick="this.parentNode.submit();" value="<%=@abc.a%>"><%=@abc.a > %><br> > <input type="radio" name="radios1" > onclick="this.parentNode.submit();" value="<%=@abc.b%>"><%=@abc.b%> > <br> > <input type="radio" name="radios1" > onclick="this.parentNode.submit();" value="<%=@abc.c%>"><%=@abc.c%> > <br> > <input type="radio" name="radios1" onclick="this.parentNode.submit();" > value="<%=@abc.d%>"><%=@abc.d%> <br> > <br> > <br> > <br> > <input type="submit"> > </form> > > please do give me a solution for thisYou have two options -- either submit the form through Ajax, so the page doesn''t get refreshed, or store the result of the form submission in the session or the database and use it to default the form to the chosen value when the visitor reloads the form. Walter -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.