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
 30 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: 838
Veteran Member
3 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
New Poster
New Poster
Congrats on posting!

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: 360
Veteran Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
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: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

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

Veteran Member
Posts: 349
Veteran Member
3 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
Engaged Reader
Engaged Reader
You are an engaged reader!
Avid Reader
Avid Reader
Avid Reader art thou!

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: 360
Veteran Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!

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: 360
Veteran Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!

Awesome, glad you got it working!

David Poindexter


Creator:


Veteran Member
Posts: 363
Veteran Member
4 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
New Poster
New Poster
Congrats on posting!
4 Engaged Reader
Engaged Reader
You are an engaged reader!
2 Avid Reader
Avid Reader
Avid Reader art thou!
2 Most Liked
Most Liked
Congrats, your posts are really liked!

Awesome Marcos! Thank you for sharing the regex code

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

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