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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:54:22+00:00 2026-06-09T02:54:22+00:00

I have a form in which I want to disable the required validation on

  • 0

I have a form in which I want to disable the required validation on one of the @Html.TextBox elements. The front end is as follows:

@model Models.NewUser

@using (Html.BeginForm("Register", "Account"))
{
    <div class="field">
        <span class="textOverField absolute em1-2" style="top:6px;left:4px;">Key</span>
        @Html.TextBox("SchoolGroupKey", "", new { @class = "textField" }) 
    </div>
    <div class="field">
        <span class="textOverField absolute em1-2" style="top:6px;left:4px;">Name</span>
         @Html.TextBox("Names", "", new { @class = "textField" }) <div class="absolute validationMessage">@Html.ValidationMessageFor(u => u.Names)</div>
    </div>
    <div class="field">
        <span class="textOverField absolute em1-2" style="top:6px;left:4px;">Last Name</span>
        @Html.TextBox("LastNames", "", new { @class = "textField" }) <div class="absolute validationMessage">@Html.ValidationMessageFor(u => u.LastNames)</div>
    </div>
    <div class="em0-9" style="margin-bottom:20px;">
        <input class="submitButton cursorHand" style="margin-top:10px;" type="submit" value="Registrarme" />
    </div>
}

And the code for the model is as follows:

public class NewUser
{
    [Required(ErrorMessage = "Name required")]
    public string Names { get; set; }

    [Required(ErrorMessage = "Last name required")]
    public string LastNames { get; set; }

    public System.Guid SchoolGroupKey { get; set; }
}

I’m guessing that the @Html.TextBox has a default validation even though I don’t specify it. Is there someway to remove it?, I tried removing the html tags data-val-required and data-val, but still no results.

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-09T02:54:23+00:00Added an answer on June 9, 2026 at 2:54 am

    Guid is a structure that behave as a simple type (just like int or DateTime). As such it is automaticly validated. If you want to make a workaround change your property type from Guid to nullable Guid?. Example:

    public System.Guid? SchoolGroupKey { get; set; }
    

    Of course you will have to change places when you use this property, to access the guid value throught Value property of nullable type.

    If the mapping fails you will not get any validation errors then – just null value inside of your SchoolGroupKey property.

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

Sidebar

Related Questions

I have a form which contains several standard controls (textbox's, buttons, etc). I want
I want to disable all fields in my form, which have values when page
I have a form which I want to be 'resusable' for a variety of
I have a form which I want to submit upon button click which is
I have a form which on submit I want to run a script via
I have a form which has only tab control in it. I want to
I have an application in which there is a form which I want to
We have a form which uses the JQuery Validation Plugin and would like to
I have an ExtJS combobox, which is a required field, but I don't want
I have a registration form which contains a read-only textarea. I want to require

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.