[CLOSED] MVC RAZOR remotevalidation datefield select event

  1. #1

    [CLOSED] MVC RAZOR remotevalidation datefield select event

    Hi,

    this doesn't seem to work :

                                                        Html.X().DateFieldFor(m => m.ES_TRANS_DATUM)
                                                        .ID("date_ES_TRANS_DATUM")
                                                        .LabelAlign(LabelAlign.Top)
                                                        .Width(150)
                                                        .FieldLabel("Transportdatum")
                                                        .Control(c =>
                                                        {
                                                            c.IsRemoteValidation = true;
                                                            c.RemoteValidation.Url = "/Home/isDateValid";
                                                            c.RemoteValidation.Method = Ext.Net.HttpMethod.POST;
                                                            c.RemoteValidation.ValidationEvent = "SELECT";
                                                            c.MsgTarget = MessageTarget.Under;
                                                            //c.RemoteValidation.Json = true;
                                                        }
                                                        )
    The above doesn't work ! Any ideas why ? What am I doing wrong ?
    If I remove
    c.RemoteValidation.ValidationEvent = "SELECT";
    it works only when I'm typing, but not
    when I select a date from the popup.
    I need the remotevalidation to work with "SELECT" AND when typing the date ......
    How can I do this ?

    Regards,
    Holger

    PS: When I look at the network traffic, no XHR is happening......
    Last edited by Daniil; Oct 12, 2012 at 5:09 PM. Reason: [CLOSED]
  2. #2
    Hi Holger,

    I think the event name should be lowercase.
    c.RemoteValidation.ValidationEvent = "select";
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi Holger,

    I think the event name should be lowercase.
    c.RemoteValidation.ValidationEvent = "select";
    This doesn't work .....
    No XHR happens .....

    Perhaps, because of the datefield ? Is it another event ?

    Regards,
    Holger
  4. #4
    You should set EventOwner. Also please use the RemoteValidation property.

    Example
    Html.X().DateFieldFor(m => m.DateTimeValue)
        .IsRemoteValidation(true)
        .RemoteValidation(rv =>
        {
            rv.Url = Url.Action("validation handler URL");
            rv.ValidationEvent = "select";
            rv.EventOwner = ValidationEventOwner.Field;
        })
  5. #5
    Quote Originally Posted by Daniil View Post
    You should set EventOwner. Also please use the RemoteValidation property.

    Example
    Html.X().DateFieldFor(m => m.DateTimeValue)
        .IsRemoteValidation(true)
        .RemoteValidation(rv =>
        {
            rv.Url = Url.Action("/Home/isDateValid");
            rv.ValidationEvent = "select";
            rv.EventOwner = ValidationEventOwner.Field;
        })
    It gets fired, but in the

            public JsonResult isDateValid(string date)
            {
    
                JsonResult result = new JsonResult();
                Object Data;
    date is always null........


    OK. I found it out :

            public JsonResult isDateValid(string value) <-----
            {
    
                JsonResult result = new JsonResult();
                Object Data;

Similar Threads

  1. MinValue when try to select a datefield value
    By tk.Mageztik in forum 2.x Help
    Replies: 6
    Last Post: Sep 12, 2012, 4:29 PM
  2. MVC 4 razor syntax and remotevalidation problem
    By ITReppert in forum 2.x Help
    Replies: 7
    Last Post: Sep 10, 2012, 3:05 PM
  3. DateField select problem
    By m2276699 in forum 1.x Help
    Replies: 1
    Last Post: Nov 04, 2011, 12:26 AM
  4. Replies: 6
    Last Post: Aug 01, 2011, 4:53 PM
  5. [CLOSED] Is it possible to Select Items of a multi select during ajax event
    By vedagopal2004 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 29, 2010, 6:28 PM

Posting Permissions