DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

character limit in a field

 8 Replies
 1 Subscribed to this topic
 23 Subscribed to this forum
Sort:
Author
Messages
New Around Here
Posts: 10
New Around Here

     

     

    Is it possible to limit characters in a given field? For example: Limit number of characters in a title or description

    In this case below, I want to limit the number of characters in the "description" field so that the text does not go outside the card.
    
    Is there this possibility in DNN?

      

     

     

    in "Fields" I can only edit the input type... would it be in this part that I could limit it?

    Veteran Member
    Posts: 763
    Veteran Member

      The module your working with is not standard DNN but 2SXC. Great module and a lot of documentation on https://docs.2sxc.org/

      Not the direct answer to your question but maybe someone else can elaborate ;-) 

      Veteran Member
      Posts: 342
      Veteran Member
        When viewing your list of fields (modal under the one showing in your screenshot), click on the “Name” of the field (“descricao”) and you will see many ways to control the field behavior.

        David Poindexter


        Creator:


        Senior Member
        Posts: 1430
        Senior Member

          FYI, Marcos... I moved your post to a forum that better matches the conversation. 😉 

          Advanced Member
          Posts: 237
          Advanced Member

            There may be an easier way, but one option is using a regex to validate the field that would only accept x number of characters.

            Something like: ^.{0,100}$
            Which means
            ^ starts with
            . Any character
            {0,100} zero to a hundred times
            $ ends

            Veteran Member
            Posts: 342
            Veteran Member

              To help a bit with what Daniel Valadas mentions, you can find this in the Field Validations section in the field configuration view.  I was going to post a screenshot here but had an error.

              David Poindexter


              Creator:


              New Around Here
              Posts: 10
              New Around Here
                Thank you all!!
                They can limit the characters using regex to validate the fields with the mentioned formula.

                ^.{0,100}$
                Veteran Member
                Posts: 342
                Veteran Member

                  Awesome, glad you got it working!

                  David Poindexter


                  Creator:


                  Advanced Member
                  Posts: 235
                  Advanced Member

                    Awesome Marcos! Thank you for sharing the regex code

                    These Forums are dedicated to the discussion of DNN Platform.

                    For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

                    1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
                    2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
                    3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
                    4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
                    5. No Flaming or Trolling.
                    6. No Profanity, Racism, or Prejudice.
                    7. Site Moderators have the final word on approving / removing a thread or post or comment.
                    8. English language posting only, please.

                    Would you like to help us?

                    Awesome! Simply post in the forums using the link below and we'll get you started.

                    Get Involved