Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Making TextArea required and validating the input
Forum Updated to NodeBB v4.3 + New Features

Making TextArea required and validating the input

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 546 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deleted379
    wrote on last edited by
    #1

    Hello,

    What is the preferred way to make TextArea QML type required and how to enable validation of entered contents, considering that this QML type doesn't have validator property?

    Thank you in advance.

    1 Reply Last reply
    0
    • IntruderExcluderI Offline
      IntruderExcluderI Offline
      IntruderExcluder
      wrote on last edited by IntruderExcluder
      #2

      You can still declare RegExpValidator (or use already existed from some input like input.validator.regExp) to store regExp and test values manually:

      ...
          RegExpValidator {
              id: rx
              regExp: /\d+/
          }
      
          Component.onCompleted: {
              console.log(rx.regExp.test("42"), rx.regExp.test("sdg")); // Produces: "true false"
          }
      ...
      
      D 1 Reply Last reply
      2
      • IntruderExcluderI IntruderExcluder

        You can still declare RegExpValidator (or use already existed from some input like input.validator.regExp) to store regExp and test values manually:

        ...
            RegExpValidator {
                id: rx
                regExp: /\d+/
            }
        
            Component.onCompleted: {
                console.log(rx.regExp.test("42"), rx.regExp.test("sdg")); // Produces: "true false"
            }
        ...
        
        D Offline
        D Offline
        deleted379
        wrote on last edited by
        #3

        @intruderexcluder said in Making TextArea required and validating the input:

        You can still declare RegExpValidator (or use already existed from some input like input.validator.regExp) to store regExp and test values manually...

        That's a good idea.

        Thank you.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved