[CLOSED] [MVC] How to get json values after RemoteValidation

  1. #1

    [CLOSED] [MVC] How to get json values after RemoteValidation

    Hi,

    I have a TextField with RemoteValidation

    Views:
    Html.X().TextField().ID("advisor_id1")
                                                          .FieldLabel("advisor_id1").MsgTarget(MessageTarget.Side).ValidateOnBlur(true)
                                                          .IsRemoteValidation(true)
                                                          .RemoteValidation(r =>
                                                              {
                                                                  r.Url = Url.Action("CheckAdvisor2", "Resource");
                                                                  r.Method = HttpMethod.POST;
                                                                  r.Json = true;
                                                                  //r.Complete = "App.int_advisor_id1.setIndicator(response)";
                                                              })
    Controllers:
    public JsonResult CheckAdvisor2(string value)
            {
                var resource = "valid";
                return new JsonResult
                    {
                        Data = resource == value
                                   ? new { valid = true, message = "ok" }
                                   : new { valid = false, message = "invalid" }
                    };
            }
    My question is how I can get json values after validations. For examples: Set indicator text of this textfield with Listeners (RemoteValidationFailure, RemoteValidationValid,...)

    Thank you,
    Last edited by Daniil; Mar 14, 2013 at 5:48 PM. Reason: [CLOSED]
  2. #2
    Hi @UnifyEducation,

    You are on the right road using a Complete handler.
    r.Complete = "alert(el.serviceResponse.message)";
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @UnifyEducation,

    You are on the right road using a Complete handler.
    r.Complete = "alert(el.serviceResponse.message)";
    Thank you, it works now.

    r.Complete = "alert(el.message)";

Similar Threads

  1. DateField and RemoteValidation
    By Birgit in forum 2.x Help
    Replies: 4
    Last Post: Jan 18, 2013, 10:57 AM
  2. AfterEdit after RemoteValidation?
    By chearner in forum 1.x Help
    Replies: 0
    Last Post: Oct 19, 2011, 6:15 PM
  3. Replies: 6
    Last Post: Aug 01, 2011, 4:53 PM
  4. [1.1] RemoteValidation
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 12, 2011, 7:44 AM
  5. RemoteValidation ?
    By nanlinfeixue in forum 1.x Help
    Replies: 0
    Last Post: Jun 20, 2011, 10:49 AM

Posting Permissions