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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:40:12+00:00 2026-06-01T23:40:12+00:00

I have a simple form in my MVC3 site that allows users to create

  • 0

I have a simple form in my MVC3 site that allows users to create a contest entry. This has been implemented and works fine currently, but a request has been made to now allow users to make their entries private.

In my Entry model I added a boolean isPrivate. Then I figured I would change the HTML forms for create and edit to include a checkbox to specify whether the entry should be private.

I’m new to MVC3, but I figured I could simply change the action that the form posts to by including a new boolean parameter.

This unfortunately doesn’t seem to work. Can anyone tell me how checkbox values are passed from an HTML form to a post action? This is probably fairly common, but I can’t seem to find an example for this on the web. Almost all the examples out there simple show text inputs, I can’t find anything with checkboxes.

Form:

        <form method="post" action="../Entry/Create" enctype="multipart/form-data" onsubmit="return isValidInput()">
            <input type="text" id="EntryTitle" name="EntryTitle" />
            <div id="invalidTitle" class="invalidData"></div>
            <p id="char-remaining">(100 characters remaining)</p>

            <input type="text" id="EntryVideo" name="EntryVideo" />
            <div id="invalidVideo" class="invalidData"></div>
            <p id="vid-desc">(URL of the Video to Embed)</p>

            <input type="file" id="ImageFile" name="ImageFile" />
            <div id="invalidImage" class="invalidData"></div>
            <p id="file-desc">(200x200px, jpeg, png, or gif)</p>

            <textarea id="EntryDesc" name="EntryDesc"></textarea>
            <div id="invalidDesc" class="invalidData"></div>
            <br />

            <input type="checkbox" id="isPrivate" name="isPrivate" />
            Make my entry private.

            <br />

            (private entries will only be viewable by you and site administrators)

            <br />


            <button id="new-entry-save">save</button>
        </form>

Action:

public ActionResult Create(string EntryTitle, string EntryVideo, HttpPostedFileBase ImageFile, string EntryDesc, Boolean isPrivate)
{
...
}
  • 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-01T23:40:13+00:00Added an answer on June 1, 2026 at 11:40 pm

    add value=”true” to checkbox, also add hidden input after it with same name and value=false, i.e.:

    <input type="checkbox" id="isPrivate" name="isPrivate" value="true" />
    <input type="hidden" name="isPrivate" value="false" />
    

    If you don’t want to use hidden, use bool? instead of bool (e.g. nullable)

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

Sidebar

Related Questions

I'm playing around with MVC3 and trying to create a simple contact form that
Using MVC3, C#, and the Razor View Engine: I have a form that has
I have simple form like this which accepts only two values string action and
I have a simple form on a view page, implemented as a user control,
I have a simple form that looks like so <% remote_form_for post, :url =>
I have a simple form like this: <form name=serachForm method=post action=/home/search> <input type=text name=searchText
I have a simple form in python + pylons that submits to a controller.
I have a simple form that searches through the 2000+ issues of a 3rd
I have a simple form that passes data to backbone, which in turn, submits
I have a simple form which uses a queryset that is set dynamically: class

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.