• 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: calculate and show the results of a Dropdown

calculate and show the results of a Dropdown 9 years 10 months ago #31557

  • info6356
  • info6356's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
Hi,

i have in my form a Dropdown with 3 items, A, B, C
people have to choose one and submit

I want at the top of the form in front end to show to people how many picked A, B and C.
So every time someone opens the form page i want him to see the 3 results so they know.

Any idea how can i do this?

thx
The administrator has disabled public write access.

calculate and show the results of a Dropdown 9 years 10 months ago #31562

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
This can be easily achieved using PHP. You would need to query the database to count the Submission Values that are equal with a,b,c and render the result in the frontend.

PS: Examples on this topic (maybe not exact, but a good start) can be found on the forum. Please use the search functionality:

https://www.rsjoomla.com/forum/search.html
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

calculate and show the results of a Dropdown 9 years 10 months ago #31570

  • info6356
  • info6356's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
Hi, i don't know coding or PHP but i understand a bit.

i thought it might be something easy that i could paste inside a hidden field and then in the form show it.

I searched in forum but couldn't find something to help me as i don't know what to look for.
Any more help will be much appreciated :-)

Thx
The administrator has disabled public write access.

calculate and show the results of a Dropdown 9 years 10 months ago #31583

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Please check this forum post:
https://www.rsjoomla.com/forum/37-rsform-pro/24346-how-to-limit-the-number-of-submissions-to-a-field.html#28333

In the example I provided here - this:
$db = JFactory::getDbo();
$db->setQuery("SELECT COUNT(`FieldValue`) FROM #__rsform_submission_values WHERE `FieldName` = 'name_of_field' AND `FormId`='". (int) $formId."'");
$count = $db->loadResult();

returns how many submissions were made for that specific field

combine it with the $formLayout part of this example:

https://www.rsjoomla.com/forum/37-rsform-pro/25876-stop-submitting-after-10-submits.html

to be more precise
$formLayout = '<p>'.$count.' submitted</p>'.$formLayout;
My help is not official customer support. To receive your support, submit a ticket by clicking here
Last Edit: 9 years 10 months ago by cosmin.cristea.
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!