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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:50:49+00:00 2026-05-11T14:50:49+00:00

My view page contains a search-by-example form with the following checkbox code: <td> <label

  • 0

My view page contains a search-by-example form with the following checkbox code:

<td> <label for='HasProcessErrors'>Has Errors:</label> <%= Html.CheckBox('HasProcessErrors', crit.HasProcessErrors) %> </td> 

The crit object HasProcessErrors property is a boolean whose initial value is false. When I view the source of my rendered page, I see that the helper has generated the following HTML:

<td> <label for='HasProcessErrors'>Has Errors:</label> <input id='HasProcessErrors' name='HasProcessErrors' type='checkbox' value='true' /><input name='HasProcessErrors' type='hidden' value='false' /> </td> 

Have I used the CheckBox helper incorrectly here, or is something odd going on? It seems like it should generate an input of type checkbox with checked = ”.

Thanks for any ideas.

  • 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. 2026-05-11T14:50:50+00:00Added an answer on May 11, 2026 at 2:50 pm

    Yes this is correct.

    The semantics of a checkbox are a little bit different from what you may think; instead of posting a value indicating its checked/unchecked state, a checked checkbox posts whatever is in its ‘value’ attribute, and an unchecked checkbox posts nothing.

    As there is also a hidden field with the same name, if you debug your form submit, you will find a checked checkbox has the value ‘true,false’ whilst an unchecked box has the value ‘false’

    You can determine if a checkbox is checked by testing if it contains ‘true’.

     public ActionResult(FormCollection form) {    bool checked = form['checkbox_id'].ToString().Contains('true'); } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form in my view page.it contains 5 text boxes,one search button.while
I currently have a product view page that contains an MVCContrib HTML Grid with
View page contains jquery code to set margin on div. below is the code
Let's say I have the following code on my view page (in asp.net mvc
I'm developing a single-page view for a resource that contains multiple nested resources. Using
My view page has a Model which is represented by a List of Students.
I have two form fields on my view page, a date input (with a
I have a form which contains textboxes,search button. when user enter the values and
I have a web page that has the following content (I've changed the URL
I have a ViewPage that contains <% Html.RenderAction<MyController>(c => c.SidebarStats()); %> . On 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.