• 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: Stop saving in database when error happens

Stop saving in database when error happens 10 years 7 months ago #28769

  • yolknet
  • yolknet's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
When submitting a form a script checks if hidden fields have the right values (to prevent spambots). If an error occurs it is displayed like this:
if ($_POST['form']['hiddenField'] != 'test') {
    $application = JFactory::getApplication();
    $application->enqueueMessage(JText::_('An error occured.'), 'error');
}

The error appears on the screen but the info is also saved in the database. How can I stop this saving?
The administrator has disabled public write access.

Stop saving in database when error happens 10 years 7 months ago #28772

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Easiest solution to achieve your scenario would be to invalidate the field with a code like the one below:
if ($_POST['form']['hiddenField'] != 'test') {
    $application = JFactory::getApplication();
    $application->enqueueMessage(JText::_('An error occured.'), 'error');
	$invalid[] = RSFormProHelper::getComponentId("hiddenField");
}

More information on PHP Scripts can be found here:
http://www.rsjoomla.com/support/documentation/view-article/602-php-scripts.html
My help is not official customer support. To receive your support, submit a ticket by clicking here
Last Edit: 10 years 7 months ago by cosmin.cristea.
The administrator has disabled public write access.
The following user(s) said Thank You: yolknet
  • 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!