• 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: Display validation error if the value is zero

Display validation error if the value is zero 11 years 2 months ago #26486

  • danilofagundes
  • danilofagundes's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 20
  • Thank you received: 5
Good morning, how to display validation error if a textbox value is zero (0)?

The intention is to prevent the sending of a form if the value of the given field is zero (0).

Thanks in advance.
Danilo
The administrator has disabled public write access.

Display validation error if the value is zero 11 years 2 months ago #26492

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

You can try using the $invalid method to invalidate the field if the submitted value is zero, more information on this method can be found here:

www.rsjoomla.com/support/documentation/v...602-php-scripts.html

A similar like the following script is added within "Scripts Called on form Process" area (backend > Components > RSForm!Pro > Manage Forms > your form > Properties > PHP Scripts):
if(intval($_POST['form']['my-textbox-field']) == 0){
	$invalid[]= RSFormProHelper::getComponentId('my-textbox-field');
}

Replace "my-textbox-field" with your textbox field exact name.
This is not official customer support. To receive your support, submit a support ticket here.
The administrator has disabled public write access.
The following user(s) said Thank You: danilofagundes

Display validation error if the value is zero 11 years 2 months ago #26501

  • danilofagundes
  • danilofagundes's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 20
  • Thank you received: 5
Perfect, thanks for the quick response.
Another situation: In a multipage form, how to make display the error in the pagebrak?
Works perfectly but only after firing the submit button.
Thanks in advance.
Danilo
Last Edit: 11 years 2 months ago by danilofagundes.
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!