• 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: default value based on drop-down query

default value based on drop-down query 13 years 2 months ago #16564

I have set up a dropdown with the following query:
//<code>
$items = "|Please Select[c]\n";
$db =& JFactory::getDBO();
$db->setQuery("SELECT id, name FROM jos_table1");
$result = $db->loadObjectList();
 
foreach ($result as $r)
$items .= $r->id. '|' . $r->name . "\n";
 
return $items;
// </code>
This part works as expected. My question: is it possible to populate the default value of a text box in the same form with a query from the same table and use the selection of the drop-down as the WHERE identifier.
Let's say in my textbox I want the default value to be something like this:
$db->setQuery("SELECT id, col1 FROM jos_table1 WHERE id = "RESULT FROM DROPDOWN");
Can anyone help me write that query and tell me where to plug it into the form? Thank you in advance for your help.
The administrator has disabled public write access.

default value based on drop-down query 11 years 7 months ago #24882

I'd also like to see a response to this question. I need to retrieve other data from the same table I'm pulling the value:label pairs for a dropdown component on a form. When you select a client name from the dropdown, I'd like their birth date to be displayed below the dropdown.

It feels like this should be fairly straightforward, but as the previous post asks, how do we use the selected dropdown value to reference the related data in the other table?
The administrator has disabled public write access.

default value based on drop-down query 11 years 7 months ago #24895

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
This can't be implemented only with PHP. You would actually need an AJAX solution. There is nothing RSForm!Pro specific about this - standard scripting knowledge is required.
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!