Paul Jonathan Thompson
2006-Jul-19 21:49 UTC
[Rails] How do I check the retuned value from check_box_tag?
Hi, I have this in my form <%= check_box_tag(@accept, value = "1", checked = false) %> Which puts a nice checkbox on my form but when I try to retrieve the value that is returned, which I expect to find in @accept, there is nothing. How do I check the returned value? Thanks, Paul Thompson
Philip Hallstrom
2006-Jul-19 21:55 UTC
[Rails] How do I check the retuned value from check_box_tag?
> I have this in my form > > <%= check_box_tag(@accept, value = "1", checked = false) %> > > Which puts a nice checkbox on my form but when I try to retrieve the > value that is returned, which I expect to find in @accept, there is > nothing. How do I check the returned value?The docs say: check_box_tag(name, value = "1", checked = false, options = {}) I think what you want is: <%= check_box_tag(''accept'', value = "1", checked = false) %> and then you''ll find the value in params[:accept]. Or you want check_box, which takes and object and a method... see the docs... -philip
Jamie Quint
2006-Jul-19 21:59 UTC
[Rails] How do I check the retuned value from check_box_tag?
The api entry looks like this... *check_box_tag*(name, value = "1", checked = false, options = {}) You want a name like "accept" rather than "@accept" and you would access it with params[:accept] On 7/19/06, Paul Jonathan Thompson <rails001@gmail.com> wrote:> > Hi, > > I have this in my form > > <%= check_box_tag(@accept, value = "1", checked = false) %> > > Which puts a nice checkbox on my form but when I try to retrieve the > value that is returned, which I expect to find in @accept, there is > nothing. How do I check the returned value? > > Thanks, > > Paul Thompson > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060719/461fc655/attachment.html
Paul Jonathan Thompson
2006-Jul-19 23:10 UTC
[Rails] How do I check the retuned value from check_box_tag?
Thanks Philip, it works just fine now. I must admit that as new to OOP rails and Ruby, I find the documentation somewhat obscure. Regards, Paul On 20/07/06, Philip Hallstrom <rails@philip.pjkh.com> wrote:> > I have this in my form > > > > <%= check_box_tag(@accept, value = "1", checked = false) %> > > > > Which puts a nice checkbox on my form but when I try to retrieve the > > value that is returned, which I expect to find in @accept, there is > > nothing. How do I check the returned value? > > The docs say: > > check_box_tag(name, value = "1", checked = false, options = {}) > > I think what you want is: > > <%= check_box_tag(''accept'', value = "1", checked = false) %> > > and then you''ll find the value in params[:accept]. > > Or you want check_box, which takes and object and a method... see the > docs... > > -philip > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >