• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Min and Max characters in the Text field.

Min and Max characters in the Text field. 11 years 7 months ago #24949

  • aakmita
  • aakmita's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
To all Gentlemen and beautiful Ladies,

As per my subject, we have some idiots sending us HTML and clear text spam via Message [text] box we have in contact form. They paste hundreds of lines and we get the crap. In the Tel number field, they only bother to enter 4 or 5 characters to get validated and it's all done.

How can I make their time wasted and protect both, tel phone number with min and max characters as well as Message field. Crying for help!

Thank you all.
RSFP is a wonderful product ;)
The administrator has disabled public write access.

Min and Max characters in the Text field. 11 years 7 months ago #24966

Hello aakmita,

Spam can occur even with the most advanced anti-spam methods. There will always be users who will try to exploit certain security holes in Joomla! by manually submitting the form with different code.

In the case of the Telephone number, at the moment this post is made, this type of validation uses the following regular expression:

/\(?\b[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}\b/i

... which should validate values like the following:

034.231.4834

... but not something like this:

4834

To limit the characters in the text field, you can simply add a PHP "Script called on form process" in the Components > RSForm!Pro > Manage Forms > edit your form > Properties > PHP Scripts area (second textarea).

Something like the following should do the trick:
if(strlen($_POST['form']['name_of_your_textarea_field']) < minimum_number_of_characters || strlen($_POST['form']['name_of_your_textarea_field']) > maximum_number_of_characters)
	$invalid[] = RSFormProHelper::getComponentId("name_of_your_textarea_field");

Please remember to adjust the script to your specific scenario (replace "name_of_your_textarea_field" and minimum/maximum_number_of_characters)

PS: Adding a ReCAPTCHA field should also help you greatly reduce the number of spam submits on your form. For more info, please visit:

www.rsjoomla.com/support/documentation/v...ptcha-anti-spam.html
Please remember that my responses aren't considered customer support, to receive customer support please submit a new customer support ticket, and we will gladly assist you.

Best Regards,
Cristian Nicolae.
Last Edit: 11 years 7 months ago by cristian.nicolae.
The administrator has disabled public write access.
The following user(s) said Thank You: aakmita

Min and Max characters in the Text field. 11 years 7 months ago #24997

  • aakmita
  • aakmita's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Thank you Cristian

That works perfectly!

Cheers.
The administrator has disabled public write access.

Min and Max characters in the Text field. 11 years 1 month ago #27150

  • domains
  • domains's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
I got this code to work, but how do you get it to give a custom error message, instead of "invalid input". I want them to know they have too many characters in the box.

Thanks,
The administrator has disabled public write access.

Min and Max characters in the Text field. 11 years 1 month ago #27154

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

The invalidation message can be simply edited from your field configuration (backend > Components > RSForm!Pro > Manage Forms > your form > edit your field > "Validation" tab > Validation message).

More information on using textbox and textarea fields in RSForm!Pro can be found here:

www.rsjoomla.com/support/documentation/v...cle/826-textbox.html
www.rsjoomla.com/support/documentation/v...le/842-textarea.html
This is not official customer support. To receive your support, submit a support ticket here.
The administrator has disabled public write access.

Min and Max characters in the Text field. 11 years 3 weeks ago #27176

Hi

Does anyone know if it's possible to validate that the telephone number field starts with a '0' rather than a minimum number of digits.

I'd be grateful for any ideas.

Thanks

Dave
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!