Using beforeValidate to permit text inside date column

Tags: #<Tag:0x00007f8b3bb15648>

Hi :slight_smile:

I was trying to use beforeValidate hook to allow text inside a date column.
beforeValidate: function(value, row, prop, mode)

Unfortunately, the returned value for beforeValidate method is the new value (Ex. 01/14/2021), but I am not really sure if this fixes my whole issue. Because, I would like to accept any type of text and that text should be the real value and not a date like 01/14/2021 or another valid date used in the example.

beforeValidate: function(value, row, prop){
  	if(prop == 1){
    	return '01/14/2021'
    }
  }

Code: https://jsfiddle.net/0zq3k7s9/4/

Thank you!

PS. So sorry to open a new topic with this again :frowning: .

Hi @jlsuarezcabrera

I would like to accept any type of text and that text should be the real value and not a date like 01/14/2021 or another valid date

So there is a pattern that you would like to set as valid and some that are not valid, correct? If so, here https://jsfiddle.net/Lkzwve5q/ is an example of a custom validator - if you find a pattern you should build a regrex that represents it.

1 Like