Pre-validate validation vee-validate?

Not sure how to go about this one so hoping for some insight on options / ideas.

I have an HTML editor, all working good. Issue is this input must have a min / max count, problem is the char-count takes into account html tags so user enters hello = 5 char but the code is actually 12 characters when you add on the

<p>hello</p> // 12 charcters get counted though user only entered 5

So when testing I could just hit enter over and over creating empty <p></p> tags until it hits the required min count, so in essence saving nothing of value

So how would one go about validating the stripped / user entered data, yet save the actual full HTML string?

// htmlString would be collected from the editor, just example here to show
var htmlString= "<h1>Hello World</h1><p>This is the text that we should get.</p>";
var stripedHtml = htmlString.replace(/<[^>]+>/g, '');
// stripedHtml = Hello WorldThis is the text that we should get. = 47 characters with spaces

So if any ideas from vee-validate user that would be great or anyone at all :slight_smile:

Thanks,

Dave

I always ask too fast,

This should actually work by attaching a the non existent field with rules

submitForm() {
  var htmlString = this.form.bio
  var stripedHtml = htmlString.replace(/<[^>]+>/g, '');
  const charRules = {
    required: true,
    min: 50,
    max: 10000
  }
  this.$validator.attach({ name: 'stripedHtml', rules: charRules })
  return this.$validator.validateAll().then(isValid => {
    // do fun stuff
  })
}

Untested yet but will update.

That did not work.
So back to ideas…