Suggestion: Adding option in dashboard if a content variable/field is required or not?

  • mad replied to this.
    ctuxboy changed the title to Required content variables/fields .

    ctuxboy Hi, the question here would be what should happen in case a variable has no value? 😉

    Yes, that is what i mean.
    The problem is, i have a postal code variable , not a textbox, but a simple input, and it's grouped automatticaly in the template settings variables, not in the content variables group, so it is 'easy', forgot adding the postal code value, when the groups are folded.
    Hope you understand what i mean.
    Maybe is it also possible restrict variables? Example: variable required only numbers?

    • mad replied to this.
      6 days later

      ctuxboy Hi, you can maybe add a simple test if the variable has content and matches only numbers and display an error if that is not the case:

      <@ if not @{ var | match ('/\d+/') } @>
          Error!
      <@ end @>

      Completely untested though but I think it can give you an idea how to approach it.
      Hope that helps! 🙂

        mad thanks for this tip! I will try this in the next days 😀

        • mad likes this.

        Newest Discussions