• 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: How prevent submission of form for certain values?

This message has been removed by user's request. 10 years 6 months ago #29330

  • 87a8787a579a7c51f812c9acd6ed5f04@RSJOOMLA_DELETED
  • 87a8787a579a7c51f812c9acd6ed5f04@RSJOOMLA_DELETED's Avatar
This message has been removed by user's request.
The administrator has disabled public write access.

How prevent submission of form for certain values? 10 years 6 months ago #29331

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Please keep in mind that a quick search on the forums would have returned alot of examples of scripts to prevent validation on different scenarios.

Information on PHP scripts can be found here:
http://www.rsjoomla.com/support/documentation/view-article/602-php-scripts.html

More information on Custom Validation rules:
http://www.rsjoomla.com/support/documentation/view-article/75-custom-validation-rules.html

Also ,you can search the forum for $invalid (is the variable used to invalidate a field)
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

This message has been removed by user's request. 10 years 6 months ago #29333

  • 87a8787a579a7c51f812c9acd6ed5f04@RSJOOMLA_DELETED
  • 87a8787a579a7c51f812c9acd6ed5f04@RSJOOMLA_DELETED's Avatar
This message has been removed by user's request.
The administrator has disabled public write access.

How prevent submission of form for certain values? 10 years 6 months ago #29335

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Please use the BBC code tags in order to display the code properly (some characters may get deleted)
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

How prevent submission of form for certain values? 10 years 6 months ago #29345

function checkstring($string,$banned_words) {
foreach($banned_words as $banned_word) {
if(stristr($string,$banned_word)){
return false;
}
}
return true;
}
 
$string = preg_replace('/\s+/','', $_POST);
$banned_words = array('bad1','bad2','bad3');
 
if (!checkstring($string,$banned_words))
$invalid[] = RSFormProHelper::getComponentId('message'); 
The administrator has disabled public write access.

How prevent submission of form for certain values? 10 years 6 months ago #29346

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Your code is already stripped, using the following code:
function checkstring($string,$banned_words) {
    foreach($banned_words as $banned_word) {
        if(stristr($string,$banned_word)){
            return false;
        }
    }
    return true;
}
 
$string = preg_replace('/\s+/','', $_POST['form']['field_name']);
$banned_words = array('whatever','bad','word','you','want','goes','here');
 
if (!checkstring($string,$banned_words)) 
  $invalid[] = RSFormProHelper::getComponentId("field_name");

if that particualr field contains one of those words, it gets invalidated. try inserting this script in the 2nd textbox area of the PHP script and in your front-end form try inserting one of those words to see how it woks.
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

How prevent submission of form for certain values? 10 years 6 months ago #29348

It did not solve me anything, I just got the thank you message after submitting.

I only changed the form and field names into "contact" and "message". The last is a Textarea component.
Last Edit: 10 years 6 months ago by bart.van.dongen.
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!