• 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 in drop down from rsform_submission

default value in drop down from rsform_submission 13 years 1 month ago #16673

I have a problem - which i have tried to solve via the support documentation but nothing is helping.

I am trying to populate a drop down box with values submitted from a previous form and have the following code in "items" in my drop down box:-

//<code>
$items = "|Please Select[c]\n";
$db =& JFactory::getDBO();
$db->setQuery("SELECT `FieldValue` FROM `jos_rsform_submission_values` WHERE `FieldName`=identity");
$result = $db->loadObjectList();
foreach ($result as $r)
$items .= $r->Identity. '|' . $r->FieldName . "\n";
return $items;
// </code>

please help me - the results are blank...
The administrator has disabled public write access.

Re: default value in drop down from rsform_submission 13 years 1 month ago #16675

i know some clever guy out there could help with this please...
The administrator has disabled public write access.

Re: default value in drop down from rsform_submission 13 years 1 month ago #16677

  • royce
  • royce's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 52
  • Thank you received: 5
You have an error in your SQL, identity should be in quotes. Fix it and try again.
The administrator has disabled public write access.

Re: default value in drop down from rsform_submission 13 years 1 month ago #16681

Tx Royce - still blank....???
The administrator has disabled public write access.

Re: default value in drop down from rsform_submission 13 years 1 month ago #16682

I changed my script to read as follows:-

//<code>
$items = "|Please Select[c]\n";
$db =& JFactory::getDBO();
$db->setQuery("SELECT `FieldValue` FROM `jos_rsform_submission_values` WHERE `FieldName`="identity"");
$result = $db->loadObjectList();
foreach ($result as $r)
$items .= $r->FieldValue"\\n";
return $items;
// </code>

I naturally do have a field - called "identity" from another form..

Any Help please - results are blank...
The administrator has disabled public write access.

Re: default value in drop down from rsform_submission 13 years 1 month ago #16683

  • royce
  • royce's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 52
  • Thank you received: 5
You have a typo in your assignment statement. You need the concatenation operator (".") between FieldValue and "\\n".

Also make sure you have valid single quotes around 'identity', it looks like the funky quotes that MS Word generates B)

Also, try it with only one backslash before the 'n'.


Worked fine for me when I made those changes.
Last Edit: 13 years 1 month ago by royce.
The administrator has disabled public write access.
The following user(s) said Thank You: waynedejager

Re: default value in drop down from rsform_submission 13 years 1 month ago #16684

@Royce

Loving the help...

changed code to follows:- but still blank :huh: :huh:

//<code>
$items = "|Please Select[c]\n";
$db =& JFactory::getDBO();
$db->setQuery("SELECT 'FieldValue' FROM 'jos_rsform_submission_values' WHERE 'FieldName'='identity'");
$result = $db->loadObjectList();
foreach ($result as $r)
$items .= $r->FieldValue(".")"\n";
return $items;
// </code>
The administrator has disabled public write access.

Re: default value in drop down from rsform_submission 13 years 1 month ago #16685

  • royce
  • royce's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 52
  • Thank you received: 5
Your syntax is wrong. This works for me:
//<code>
$items = "|Please Select[c]\n";
$db =& JFactory::getDBO();
$db->setQuery("SELECT `FieldValue` FROM `#__rsform_submission_values` WHERE `FieldName`='identity'");
$result = $db->loadObjectList();
foreach ($result as $r) {
	$items .= $r->FieldValue . "\n";
}
return $items;
// </code>

Also, I always VERY strongly suggest to ALWAYS use the squiggly brackets '{}" around ALL loops. It will save you hours of debugging. I wish RSFP followed this simple coding standard that is part of Joomla!
developer.joomla.org/coding-standards.html
Last Edit: 13 years 1 month ago by royce. Reason: removed DB prefix
The administrator has disabled public write access.
The following user(s) said Thank You: waynedejager

Re: default value in drop down from rsform_submission 13 years 1 month ago #16686

@Royce

if you ever in South Africa brother - i owe you a bottle of Johnny Black!!!

You are a legend
The administrator has disabled public write access.

Re: default value in drop down from rsform_submission 13 years 1 month ago #16687

  • royce
  • royce's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 52
  • Thank you received: 5
Glad to help. In case anyone else looks at this, I fixed the code to remove my unique DB prefix.

If you are ever in Sunny Florida USA, look me up!
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!