• 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: Limit submission to total radio value?

Limit submission to total radio value? 14 years 3 months ago #9634

  • Hazwan
  • Hazwan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
How to limit the submission form to the number of radio value? In my case, I want to set up a form for registering a squash tournament but I want to have 8 male and 8 female players only.

In the form I have include the gender as a radio button.

Thank you.

Regards,
Hazwan
The administrator has disabled public write access.

Re:Limit submission to total radio value? 14 years 3 months ago #9653

  • andreic
  • andreic's Avatar
  • NOW ONLINE
  • RSJoomla! Official Staff
  • Posts: 733
  • Thank you received: 60
Hello,

I have created an example with a radio group "Sex" with two elements : "Male" and "Female" and a submit button. After that I added this script in the "Scripts called on form display" (this is only for the "Male" option):
$database = JFactory::getDBO();
$database->setQuery("SELECT COUNT(`SubmissionId`) FROM jos_rsform_submission_values WHERE `FormId` = '16' AND `FieldName` = 'Sex' AND `FieldValue` = 'Male'");
$database->query();
if (intval($database->loadResult()) >= 8)
{
     $formLayout = $formLayout. "<script type='text/javascript'>
																document.getElementById('Sex0').style.display='none';
																var tst = document.getElementsByTagName('label');
																for( var i=0;i<tst.length;i++)
																if(tst[i].getAttribute('for') == 'Sex0')
																tst[i].style.display = 'none';
								</script>";
 
}

All you need to do is add the code for the "Female" option and it should work
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
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!