[CLOSED] Validation form

  1. #1

    [CLOSED] Validation form

    Hi!

    I have code

    X.Window()
                  .ID("wndModule")
                  .Icon(Icon.Cog)
                  .Modal(true)
                  .Layout(LayoutType.Fit)
                  .Items(
                      X.FormPanel()
                          .ID("formModule")
                          .Layout(LayoutType.Form)
                          .Frame(true)
                          .Items(
                           X.TextField()
                                  .AllowBlank(false)
                                  .ID("text_moduleName")
                                  .FieldLabel("Module name),
    
    ..... //and other
                          )
                          .Buttons(
                              X.Button()
                                  .ID("btnUpdateModule")
                              .DirectEvents(de =>
                              {
                                  de.Click.Before = "validationWindow";
                                  de.Click.Url = Url.Action("UpdateModule");
                                  de.Click.ExtraParams.Add(new Parameter { Name = "moduleId", Value = "#{hid_moduleId}.getValue()", Mode = ParameterMode.Raw });
                                 
                              })
                              
                          )
                  )

     
    var validationWindow = function () {
                return this.up('form').isValid();
            }
    If I used function validationWindow - it's work

    But if I use

    de.Click.Before = "this.up('form').isValid()";   - it's not worked

    Why is this happening?

    I use ext.net mvc 3.3

    Thanks!
    Last edited by fabricio.murta; Apr 27, 2016 at 3:10 PM. Reason: [CLOSED]
  2. #2
    Hello @SuperBolt!

    The .Before property receives a reference to a function, so it can't really receive code.

    Usually listener event handlers have either a .Fn (which is equivalent in parameter to the .Before you shown) and also a .Handler which receives actual JavaScript code. In your case, it is a direct event -- server side -- so it really works differently.

    Additionally, in the example you tried, you just run .isValid() and not really returned anything. But it would not be working unless you wrap your code in a function. For example this should just work:

    de.Click.Before = "function() { this.up('form').isValid(); }";
    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Ok, thanks! Closed.

Similar Threads

  1. Form Validation with Checkboxes
    By SaleCar in forum 3.x Help
    Replies: 8
    Last Post: Mar 04, 2015, 6:41 AM
  2. [CLOSED] Form validation including form on user control
    By jbarbeau in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 22, 2014, 12:42 PM
  3. form validation problem
    By ozayExt in forum 1.x Help
    Replies: 1
    Last Post: Oct 27, 2011, 7:05 AM
  4. Login form - validation form
    By LordMX in forum 1.x Help
    Replies: 0
    Last Post: Aug 14, 2011, 11:44 AM
  5. [CLOSED] validation form all
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 22, 2011, 8:05 PM

Tags for this Thread

Posting Permissions