• 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: Hide checkbox option by parameter sent through URL

Hide checkbox option by parameter sent through URL 9 years 3 months ago #33866

Hello, everybody.

I want make a form that displays checkbox items according the URL parameters (or something similar that allows me to display the options from a database).

I could use this:
//<code>
$db =& JFactory::getDBO();
$db->setQuery("SELECT field FROM `my table` where id=" user id );
$result = $db->loadObjectList();
foreach ($result as $r) {
$items .= $r->field . "\n";
}
 
return $items;
//</code>

The problem is that I want guests to access the form with an especific user options. For example, John's friends can access to the form with John's options (without sign in).

To solve this, I'm using, two forms (one hidden and one visible), the 'parameters through URL option' and Javascript.

ie: /index.php?option=com_rsform&formId=1&form[hiddenCheckbox][]=item1&form[hiddenCheckbox][]=item2 (the URL is made with the elements of the database, no prob here (this would be the URL that John gives to his friends))

And with JavaScript on windows load:

if hiddenCheckbox item1 is checked then visibleCheckbox item1 is displayed
if hiddenCheckbox item2 is checked then visibleCheckbox item2 is displayed

And so on (obviously with a cycle).


It barely works (sometimes it doesn't, IDK why) but I find this 'solution' a little a lot rudimentary and not very efficient.

I know it's a pretty complex problem, but does anyone has a better idea?
The administrator has disabled public write access.

Hide checkbox option by parameter sent through URL 9 years 3 months ago #33871

I solved it with
$jAp = JFactory::getApplication();
$q = $jAp->input->get('q');

And passing the user ID via URL like /index.php?option=com_rsform&user_id=426

Pretty easy.
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!