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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:36:26+00:00 2026-06-19T01:36:26+00:00

I have an Ajax.BeginForm() in a partial view that contains a CheckBox for a

  • 0

I have an Ajax.BeginForm() in a partial view that contains a CheckBox for a bool value. The model is as follows;

public class ViewBusinessAdd
{
    [Required(ErrorMessage="Name must be supplied")]
    [Display(Name = "Business Name")]
    public string Name { get; set; }

    [Required(ErrorMessage = "Contact must be supplied")]
    [Display(Name = "Business Contact")]
    public string Contact { get; set; }

    [Display(Name = "Phone Number")]
    public string Number { get; set; }

    public string Postcode { get; set; }

    public Dictionary<string, string> States  { get; set; }

    public string AddressRegion { get; set; }

    public bool IsFacebookPost { get; set; }

    public List<RecommendationViewAttribute> Attributes { get; set; }
}

The CheckBox is rendered using the Html helpers;

<div class="control-group">
   <label class="control-label">
      @Html.LabelFor(m => m.IsFacebookPost, "Post recommendation")
      <img src="~/Content/images/f_logo.png" alt="Facebook" />
   </label>
   <div class="controls">
      @Html.CheckBoxFor(m => m.IsFacebookPost)
   </div>
</div>

This produces the following HTML when rendered;

<input data-val="true" data-val-required="The IsFacebookPost field is required." id="IsFacebookPost" name="IsFacebookPost" type="checkbox" value="true" /><input name="IsFacebookPost" type="hidden" value="false" />

When submitting the form with, it produces this error in Chrome;

Uncaught SyntaxError: Unexpected token u

If I remove the CheckBox the form submits without any error. If I convert this to a non-Ajax form, it also submits but that’s not going to work with the page design unfortunately.

I’m absolutely stumped on this – I even changed this to a RadioButton and the same behavior exists. Does anyone have any ideas?

Edit: Forgot to add it’s a Javascript error.

Edit: The error is coming from jQuery library on the return below;

parseJSON: function( data ) {
// Attempt to parse using the native JSON parser first

  if ( window.JSON && window.JSON.parse ) {
      return window.JSON.parse( data );
  }

But this only happens if I use the Razor HTML helpers to generate the checkboxes.

  • 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-19T01:36:27+00:00Added an answer on June 19, 2026 at 1:36 am

    Well it seems there was a bug introduced with jQuery 1.9.1. I’ve downgraded to 1.8.3 and the Razor helpers for the Checkboxes now work correctly. Steps to downgrade if anyone is interested;

    Uninstall-Package jQuery -force

    Install-Package jQuery -version 1.8.3

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

Sidebar

Related Questions

I have a partial view which contains the following snippet: @model Mbrrace.Domain.MbrraceForm <div class=row>
I have the following code in a partial view: @model MyOrganization.MyApp.Models.ProductListing @using (Ajax.BeginForm(TagProduct, new
I have a MVC View that generates multiple Ajax.BeginForm , with a button in
I have a partial view with a view model that has a collection of
Inside of an asp.net mvc partial view, I have an Ajax form that posts
I am using the partial view with the ajax.beginform. In that partial view page,
I'm having some difficulties with Ajax.BeginForm I have something like this in a view
I have a mvc2 application with a view like this <% using (Ajax.BeginForm(UserApprove, new
I have the following view definition in my asp.net mvc website: <% Using Ajax.BeginForm(UsrCtlChangePassword,
I have a beginform that automatically sends EVERYTHING to the controller via a ajax

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.