Text cell with required validation

4 posts, 0 answers
  1. iFACTS Admin
    iFACTS Admin avatar
    9 posts
    Member since:
    Feb 2017

    Posted 02 Nov 2018 Link to this post

    Hi!

    I am attempting to add required validation to a text cell.

    Here's a demo attempt: https://dojo.telerik.com/uPoZUgAy/3

    I only succeed if I uncomment the function in the "from" property, otherwise it crashes. 

    The fix I found is probably a hack-y approach, so I am opening this thread to find the recommended approach for my situation...

     

    Thanks!

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5454 posts

    Posted 06 Nov 2018 Link to this post

    Hi Peter,

    An empty cell that should not be empty gets a small triangle that has a comment with the validation message, much like an Excel comment. This is switched on through the allowNulls: false setting.

     

    The empty cell validation in the spreadsheet widget is a little more discreet than what you seem to be looking for because having such popups is likely to cause performance issues and reduce usability. This is the most significant reason why the delete operation is not validated and users are allowed to clear out a cell easily.

    If you want to make such cells stand out, you can add a CSS class override to to that: https://dojo.telerik.com/@bratanov/IPIPeLUW/2. It result in the following when you clear out the cell: https://www.screencast.com/t/GPbetxKXp.

    I have also added this enhancement request to our backlog and you can monitor its status in the following page: https://github.com/telerik/kendo-ui-core/issues/4648.

    You can also employ the approach from the following article to review the cell validation status of the sheet and collect invalid cell info so you can inform the user that they need to take action with some custom UI (e.g., some dialog, notification alert or other approach suitable for your needs). Link: https://docs.telerik.com/kendo-ui/controls/data-management/spreadsheet/how-to/get-flagged-cells.


    Regards,
    Marin Bratanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. iFACTS Admin
    iFACTS Admin avatar
    9 posts
    Member since:
    Feb 2017

    Posted 06 Nov 2018 in reply to Marin Bratanov Link to this post

    Marin, thanks for the useful information.

    But I think I wasn't very clear in my description of my issue :)

    Setting validation.allowNulls: false, as I want and as you suggested, will trigger an error (try it in my demo code). I only get around that issue if I set the validation.from as well. Think it, through trial and error, I noticed that the crash goes away if I put an empty function as the value of validation.from.

    Is this the right way to make a cell required?

     

    Thanks!

  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5454 posts

    Posted 06 Nov 2018 Link to this post

    Hi Peter,

    Yes, this is the way. You will also see that my example also contains some (dummy) from function. The from setting is mandatory and I have added this info to the documentation (and it will be live soon). Depending on the enhancement implementation, this may change, but I cannot say at this point whether from will still be mandatory for this scenario (it is likely that it will be since this is generally mandatory for validation).


    Regards,
    Marin Bratanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top