Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Textarea validation 13 Jul 2012 08:55 #2787

Hi,
in my table is a text field checked by the regular expression: ^.{0,2500}$

when want to go to a new line (pressing enter key) shows the validation error.

I want to have text box where a user can enter up to 2500 characters long and can move to the new line.
How do I?

Please Log in or Create an account to join the conversation.

Re: Textarea validation 24 Sep 2012 12:33 #3942

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hi there,

text fields don't typically allow new line characters so, for a field in which you wish to store descriptive text, especially when it needs to store new lines, you should almost always use a richtext field instead.

If you need to restrict the char length, you can still do that using regex.

Check out some other Joomla DB tables, for example, '#__content' for example to see how it stores articles.

Hope this helps!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Re: Textarea validation 14 Nov 2012 16:44 #5361

  • g1smd
  • g1smd's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • RegEx fiend!
  • Posts: 31
  • Thank you received: 26
^.{0,2500}$

Are you sure you want to allow ANY character, or should you be restricting the input to letters, digits and certain punctuation?

Are you sure that 0 is a valid value, so that the user can leave the field blank - or should there be a larger minimum size?
Online since 1996.

Please Log in or Create an account to join the conversation.

Last edit: by g1smd.

Re: Textarea validation 14 Nov 2012 17:42 #5362

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Agreed (@g1smd), you might at least want to specify a realistic minimum length rather than 0 however, textarea inputs can be configured to allow/disallow certain html tags using some of joomla's built in filters in addition to restricting lower and upper bounds for the length of input value. Here are some of the filters:

Default Black List - All the tags and attributes are allowed expect the following ones:
Tags - 'applet', 'body', 'bgsound', 'base', 'basefont', 'embed', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', 'title', 'xml';
Attributes - 'action', 'background', 'codebase', 'dynsrc', 'lowsrc';
More tags and attributes can be entered in the Filter Tags and Filter Attributes fields. The list items should be separated with comma.

Custom Black List - Can overwrite the tags and attributes included in the above list. Again, they should be added in the Filter Tags and Filter Attributes fields.

White List - Only the specified tags and attributes will be allowed.

No html - All the HTML code will be filtered.

No filtering - The filtering is disabled. Usually this option is selected for the Joomla 2.5 Super Users and Administrators accounts.

These can actually be set in the XML:
See howl: docs.joomla.org/Textarea_form_field_type

Gez

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The following user(s) said Thank You: admin, g1smd

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.061 seconds

  Merci d'avoir présenté ce service web générateur de composant joomla. L'interface est très conviviale on a le plaisir du drag&drop et c'est assez rare pour être signalé. Je souhaite que ce projet connaisse un fort succès votre réalisation est méritante.
Yann Gomiero (AFUJ - France)

Get Started