I got the following piece of code :
name: yup
.string()
.trim()
.required(message("nameMissing"))
.max(40, message("nameTooLongWithStatus", {
length: (HERE I NEED HELP),
})),
Refer to the line where I wrote "HERE I NEED HELP".
I want it to be something like: name.toString().length
But this obviously doesnt work, actually nothing that I tried worked. I simply want to get the value of 'name' and get it's length, that is all.
So the idea is that, "name" should be a string with at most 40 characters. If it is more than 40, a message will be displyed saying "The maximum character count is 40 (current length)" where current length is the name you provided as input.
message("nameTooLongWithStatus" will accept a parameter "length" and will construct the said message.