javascript - Is it possible to check the textbox value in MVC without clicking submitting/postback -


I'm new to MVC.

I have a form, let's call it a registration form. I have 10 text boxes in it (id, name, address..atc) when the user enters the id - I have to check in db, whether it is already available and then i need to display the status.

Is it possible in MVC ??

Yes it is not really difficult to achieve this, you can use RemoteAttribute on the property of your model which you On the server you want to validate asynchronously, in your case this is id .

  // model public class MyModel {[remote ("valid IID", "MyController")] public string id {get; Set; }} // Controller Public Class MyController {Public ActionResult ValidateId (String ID) {// The action will be applied when you change the value in the browser. // If you fail in verification, you will need to return a string in which there is an error // or correct if the ID is valid. // In this case the ID is valid / return Json (true, JsonRequestBehavior.AllowGet); // In this case ID is not vlaid // returns Jason ("id is not valid", jesunoveest beehiveer aloovet); }} See also: 


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -