Custom popup editor AngularJs Validation DropDownList

6 posts, 1 answers
  1. Steve
    Steve avatar
    22 posts
    Member since:
    Feb 2016

    Posted 14 Mar 2016 Link to this post

    Hi,

       I read many threads about validation in kendo UI, but I don't find what I'm looking for.  I have a grid with Custom Popup Editor and AngularJs like this example.  When I add a validation in the schema for my grid data source, User cannot save.  Because it is a dropdownlist with a default value, required validation does not work.  I tried this example for custom validation, but message is not shown.  I added this line in the template for popup editor:

    <span class="k-invalid-msg" data-for="AssignmentType"></span>

    It works for a simple textbox, but not for a dropdownlist.

    Any ideas?

    Note to Telerik Team:  There is many documentation everywhere very nice, but when we use dropdownlist in a grid, it is difficult to find the right way to go.

    My two cents

    Thank you

  2. Steve
    Steve avatar
    22 posts
    Member since:
    Feb 2016

    Posted 15 Mar 2016 in reply to Steve Link to this post

    Hi,

       I found this solution here.  It works great except that I'm not in angular in the "onSave".  Is it possible to use angular in the save button (called from the custom popup editor) ?

     

    Thank you

  3. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 18 Mar 2016 Link to this post

    Hello Steve,

    I'm not sure I understood what you mean by "Is it possible to use angular in the save button (called from the custom popup editor) ?" Could you please clarify?

    Regards,
    Rosen
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  4. Steve
    Steve avatar
    22 posts
    Member since:
    Feb 2016

    Posted 18 Mar 2016 in reply to Rosen Link to this post

    Hi,

         I found a way to validate in the custom template popup editor (when I set value to dropdownlist to null, I have a message below).  However, when I click on Save button in this editor, nothing happen.  User does not know what is wrong.  So, I tried to manage onSave event on the grid to show a message with all validation errors, but it does not work, because I don't have access to $scope (angular).

     

    Thank you

  5. Answer
    Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 21 Mar 2016 Link to this post

    Hello Steve,

    You should be able to access the $scope in the save event depending on how your code is structured. However, you should be able to show custom validation without need to access the scope. Here is a modified version of the custom popup sample which demonstrates a possible implementation. Beside the custom rule you should note the added message placeholder and name attribute of the validated element.

    Regards,
    Rosen
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Steve
    Steve avatar
    22 posts
    Member since:
    Feb 2016

    Posted 21 Mar 2016 in reply to Rosen Link to this post

    Thank you very much for your help. Even if validation was working when I clicked in the dropdownlist (using input.is("[data-bind='value: AssignmentType']")), it was not shown on save click because I didn't put a name to control in the custom template.

    Thank you

Back to Top