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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:13:39+00:00 2026-05-26T23:13:39+00:00

I am using a Remote validation attribute on my view model to validate a

  • 0

I am using a Remote validation attribute on my view model to validate a Bank Account that is specified for my Company:

ViewModel:

[Remote("CheckDefaultBank", "Company")]
    public string DefaultBank
    {

This in the controller I have:

    [HttpGet]
    public JsonResult CheckDefaultBank(string defaultBank)
    {
        bool result = BankExists(defaultBank);
        return Json(result, JsonRequestBehavior.AllowGet);
    }

That all works well. But, I have two other banks related to my company as well. However, when the remote validation js calls the action it uses a parameter mactching the field name of “DefaultBank”… so I use that as a parameter in my action.

Is there some attribute I can add in the view so that it will use a parameter of say “bankId” on the ajax get so I don’t need an action for each field which are basically exactly the same?

The goal here is to eliminate now having to have this in my controller:

[HttpGet]
    public JsonResult CheckRefundBank(string refundBank)
    {
        bool result = BankExists(defaultBank);
        return Json(result, JsonRequestBehavior.AllowGet);
    }

[HttpGet]
    public JsonResult CheckPayrollBank(string payrollBank)
    {
        bool result = BankExists(defaultBank);
        return Json(result, JsonRequestBehavior.AllowGet);
    }

I was hoping I could do something like this in the view:

@Html.EditorFor(model => model.DefaultBank, new { data-validate-parameter: bankId })

This way I could just use the same action for all of the Bank entries like:

[HttpGet]
    public JsonResult CheckValidBank(string bankId)
    {
        bool result = BankExists(bankId);
        return Json(result, JsonRequestBehavior.AllowGet);
    }

Possible?

  • 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-05-26T23:13:39+00:00Added an answer on May 26, 2026 at 11:13 pm

    Since MVC uses the default model binder for this, just like a normal action method. You could take a FormsCollection as your parameter and lookup the value. However, I personally would find it much easier to just use several parameters to the function, unless you start having dozens of different parameters.

    You could also write a custom model binder, that would translate the passed parameter to a generic one.

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

Sidebar

Related Questions

In an MVC3 app, using jquery unobtrusive validation, and a view/model with a [Remote]
Using asp.net MVC3, I have a partial view which requires remote validation. As I
I just discovered that remote validation using the RemoteAttribute will not work unless either:
I am using remote validation to make sure that the email and username fields
I'm using form_remote_for() to do validation on a form's data so that my rails
I have a form in which I am using remote validation to check if
I'm using the jquery validation control remote method to test if an email address
I have a model called Organisation, on the organisation I have a remote validation
i'm using this plug in to validate a form http://bassistance.de/jquery-plugins/jquery-plugin-validation/ I've got 3 fields,
I have a form that validates using the jQuery plugin: Validation, v1.9.0. The validation

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.