Playing Next Lesson In
seconds

Validating Query String Filter Values

In This Lesson

We'll learn how to use VineJS, AdonisJS' Validator, to validate the filter properties and values we have within our query string.

Created by
@tomgobich
Published
Last updated

Join the Discussion 3 comments

Create a free account to join in on the discussion
  1. @adun

    I had a strange behavior, the movie index page search :

    • OK without a query filter

    • OK with an alphanumeric query filter

    • Fails after removing an existing query filter, showing the following error after the title input:

    The search field must contain only letters and numbers

    When the query filter is removed, the search field value becomes an empty string instead of undefined or null.

    To fix this behavior, add the following line after your import statements:

    vine.convertEmptyStringsToNull = true

    1
    1. Responding to adun
      @adun
      1
      1. Responding to adun
        @tomgobich

        Terribly sorry about that adun! I'm happy to see you were able to figure it out, and your assessment is spot-on! I'll circle back and insert a heads-up into this lesson. Thank you very much for sharing, and sorry again this got past me!

        1