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 8398383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:02:35+00:00 2026-06-09T21:02:35+00:00

Hi I have the following code on my view: //I write a loop here

  • 0

Hi I have the following code on my view:

//I write a loop here to display some workflows saying wkf.each do |i|
<% if (i write my condition here) %>
  <td style="text-align:left;">
  <%= f.check_box :i, {:checked=>true}%> 
  <%= f.label(i, i)%>
  </td></tr>
<% else %>
  <td style="text-align:left;">
  <%= f.check_box(i)%> 
  <%= f.label(i, i)%>
  </td></tr>
<%end%>

Suppose that there are three workflows ‘A’, ‘B’ and ‘C’ and ‘C’ meets the if condition,
then the parameters being sent are ‘A’=>0, ‘B’=>0 and ‘i’=>’1’.
I want it to be sent as ‘C’=>’1’ in the same way as ‘A’=>0.

I know that ‘i' =>'1' is sent because i wrote f.check_box :i, {:checked=>true}% instead of
<%= f.check_box(i)%>.

Please let me know how to change this so that, the check box is checked by default when the if condition is met and the #{i} would be sent instead of :i

Thanks

  • 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-06-09T21:02:36+00:00Added an answer on June 9, 2026 at 9:02 pm

    The f.check_box :i is not equal to f.check_box(i), the difference is that the i is a variable, while :i is a symbol, which is almost like a string. Remove the : in the first case.

    <%= f.check_box i, {:checked=>true} %> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in a view to get some of the information
I have following line code in my view: <td> Model.some_instance_method(args) </td> I would like
I have the following code in my view: <%= form_for :command_selected, :method => get,
I have the following code in my view .fields = f.label :minimum_mpg %br =
I have the following code in a view: <div class=wrap_select> @Html.DropDownList(dateRange, new SelectList(Model.DateRange, Value,Text),
I have the following code in my index view. latest_entry_list = Entry.objects.filter(is_published=True).order_by('-date_published')[:10] for entry
I have the following code in a partial view (using Spark): <span id=selectCount>0</span> video(s)
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new
I have the following code: var GoalPanelView = Backbone.View.extend({ // Bind to the goal
I have the following code in my accounting application: // switch View to the

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.