• 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: multi checkbox validation

multi checkbox validation 11 years 3 months ago #26263

Hello,

I have 3 rows of checkboxes:
question 1: [ ] [ ] [ ]
question 2: [ ] [ ] [ ]
question 3: [ ] [ ] [ ]

I don't want to show an error if only one checkbox has been selected.
If none is selected an error should appear: 'please select at least on'.
is this possible with some custom ajax validation code?

thanks,
P.
The administrator has disabled public write access.

multi checkbox validation 11 years 3 months ago #26290

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

From what I understand, the error will only show when no checkbox is selected at all(from all your rows). If this is the case, you can try using the $invalid method on this, example:
if(!isset($_POST['form']['checkbox1']) && !isset($_POST['form']['checkbox2']) && !isset($_POST['form']['checkbox3'])){
	$invalid[] = RSFormProHelper::getComponentId('checkbox1');
}

For the script above to work you will have to replace the checkbox names with your exact checkbox names. Also, the script is added by going to backend > Components > RSForm!Pro > Manage Forms > your form > Properties > PHP Scripts > "Scripts called on form process" area. More information on this can be found in the following article:

www.rsjoomla.com/support/documentation/v...602-php-scripts.html
This is not official customer support. To receive your support, submit a support ticket here.
Last Edit: 11 years 3 months ago by adrianp.
The administrator has disabled public write access.

multi checkbox validation 11 years 3 months ago #26299

Thanks, that looks good. I will try that.
I was also looking for a ajax solution. Is that possible without altering the script.js file?
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!