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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:18:53+00:00 2026-06-04T13:18:53+00:00

i am having a problem with validating a form in MVC Razor the Binding

  • 0

i am having a problem with validating a form in MVC Razor the Binding class is the following based off an abstract class (there is no validation in the abstract class)

[GeminiDisplayName("You are about To reject the following Purchase Order", false)]
    public class PORejected : PoApprovalItems
    {
        public PORejected() { }
        [GeminiDisplayName("Rejection Reason")]
        [Required(AllowEmptyStrings = false, ErrorMessage = "Rejection Reason is Required")]
        public string RejectReason { get; set; }

        public override bool IsApproved
        {
            get
            {
                return false;
            }
        }
    }

and the view is as follows

@model Gemini.Models.PORejected
    @section Head{
        <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/MicrosoftMvcValidation.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/PageScripts/_Approval.js")" type="text/javascript"></script>
    }
    @section TabHeader{
        <li><a href="#ApprovalItem">Reject Approval for PO @Model.PO_Number</a></li>
    }
    @section TabContent{
        @{
            Html.EnableClientValidation();
        }
        <div id="ApprovalItem">
            @{
                @Html.ValidationSummary(false)
                using (Html.BeginForm("Approve", "PO", FormMethod.Post))
                {

                @Html.Partial("Approval/ApprovalDetails", Model)
                <div class="display-label">
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td width="15%">
                                @Html.LabelFor(x => x.RejectReason)
                            </td>
                            <td>
                                @Html.TextAreaFor(x => x.RejectReason, new { @Class = "mceEditor required", @style = "width:60%;" })
                                @Html.ValidationMessageFor(x => x.RejectReason)
                            </td>
                        </tr>
                    </table>
                    <div style="float: right;">
                        <input type="button" value="Close" />
                        <input type="submit" value="Reject" />
                    </div>
                </div>
                    Html.EndForm();
                }
            }
        </div>
    }

the thing is when i click the submit button it fires off before doing any validation even though it should validate

my question is what am i doing wrong?

UPDATED
found the answer eventually i was missing the following from the page.
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>

  • 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-04T13:18:56+00:00Added an answer on June 4, 2026 at 1:18 pm

    found the answer eventually i was missing the following from the page. <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>

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

Sidebar

Related Questions

Hi there I am having a problem with my form validation, basically the problem
I need to do a form validation with jQuery. But I'm having a problem
I´m having problem using validation on DropDownListFor ... My Model : public class User
I am having a problem with some bean validation. Basically I have a form
I am having problems getting validation to work for a form built using Zend_Form.
I'm having problem with Rails plugin attachment_fu . On every upload, I get validation
I am having problem that when i am trying to submit the form by
I'm having problem on a custom inlineformset. I want validation to skip rows which
I am having a problem with my jquery form. If you look at this
I'm having the problem that I cannot get client-side validation to fire from within

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.