Forbidden Words and Strings in a Form Submission

mapme 09 Nov, 2010
Hello,
There is a great feature in Community Builder when you create a new field you can specify illegal characters and strings. This is a great anti-spam measure and also stops people filling out forms by using bad characters and potentially anti-hacking scripts.

Is this possible in Chronoforms? I bought the ChronoForms for Joomla Site Cookbook from Bob, but cannot find a solution in that.

Any suggestions?

Thanks,

Brendan
GreyHead 09 Nov, 2010
Hi Brendan,

There's nothing specific in ChronoForms. You can add browser-side validation to use a Regular Expression; or, better, server-side validation to use any filters you like. Pages 108-116 of the book cover most aspects of this.

Bob
mapme 09 Nov, 2010
Thanks Bob,
Can you provide a brief example of the PHP for how I would omit the string "http://" from a field called "NAME"?
I can't get that demo from those pages. From one simple example like that I would be able to take it from there.
Sorry for bothering you, hope you can help out with this.
Brendan
GreyHead 09 Nov, 2010
Hi Brendan,

<?php
$name = JRequest::getString('NAME', '', 'post');
$name = str_replace('http://', '', $name);
JRequest::setVar('NAME', $name);
?>

Bob
mapme 09 Nov, 2010
Thanks a lot Bob,
That will do perfectly.
I really appreciate it.
Brendan
This topic is locked and no more replies can be posted.