Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 539387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:07:51+00:00 2026-05-13T10:07:51+00:00

I am trying to re render a page with a checkbox that has been

  • 0

I am trying to re render a page with a checkbox that has been selected prior to the render.

With the result, I converted it to an integer.

if I have the following code, how do I make the checkbox either checked or not

check_box("price", "total", {:checked => @checkVal})  where @checkVal is my checked/not value (int)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:07:51+00:00Added an answer on May 13, 2026 at 10:07 am

    If you are using check_box, Rails is assuming that you have a @price object that has a total attribute. If this is the case, you can set the checkbox to be checked by setting @price.total to true (likely in your controller). Example:

    class UserController < ApplicationController
    
      def new
        @user = User.new
        @user.terms_of_service = true
      end
    

    will result in a checked box in your view:

    <%= check_box(:user, :terms_of_service) %>
    

    If you don’t have a Price model with a total attribute, you likely should be using check_box_tag instead (which has info on how to set checked).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to figure out how I can render a page in
I'm trying to render sliders instead of select components. Each page has several select
I'm trying to render templates of an html-page that contains swedish characters åäö but
I have been trying to render JSON data in a JQGrid. I get the
I have a website and I've been trying to gather statistical data (mostly page
I wonder why WebKit trying to render my page as XML instead of HTML..
I'm trying to render a html page with an image in it. I am
Im trying to render emails on my site. The problem is that these emails
I've been trying to render a webpage using the Adobe Flex / Flash builder
I'm trying to render out some images on an aspx page. Error I'm getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.