• 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: get submitted value

get submitted value 10 years 9 months ago #28247

  • djseleco
  • djseleco's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 47
  • Thank you received: 10
Hello guys, it's been months that i try to achieve this objective

In Form B i want to have a Dropdown field where the users can select only their own submitted values in Form A

I have have tried this code but is uncomplete for my objective

//<code>
$my = & JFactory::getUser();
$db = JFactory::getDBO();
if($my->get('id')){
$id_utente = $my->get('id');
$db->setQuery("SELECT FieldValue FROM #__rsform_submissions LEFT JOIN #__rsform_submission_values ON #__rsform_submissions.SubmissionId=#__rsform_submission_values.SubmissionId WHERE #__rsform_submission_values.`FieldName`='EMAIL' AND #__rsform_submissions.FormId='FORM A (ID)' AND #__rsform_submissions.UserId=".$id_utente." ORDER BY #__rsform_submissions.SubmissionId");
$results = $db->loadObjectList();
foreach ($results as $res){
return $res->FieldValue;
}
}
//</code>

I need to have |Please Select[c] option, and 2 fields from Form A (email, name) value|label

Please help me

Thanks in advance :)
The administrator has disabled public write access.

get submitted value 10 years 9 months ago #28250

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
You can try the code below, keep in mind it's only an example and not a solution.
//<code>
$items = array();
 
$db = JFactory::getDbo();
$user = JFactory::getUser();
 
$items[] = "|Please Select[c]";
 
$db->setQuery("SELECT `FieldValue` FROM #__rsform_submission_values LEFT JOIN #__rsform_submissions ON #__rsform_submission_values.SubmissionId = #__rsform_submissions.SubmissionId WHERE #__rsform_submissions.`UserId`='". $user->get('id')."' AND #__rsform_submission_values.`FormId` = form_id_here AND #__rsform_submission_values.`FieldName` = 'field_name_here'");
$results = $db->loadObjectList();
 
foreach ($results as $result) {
 $value = $result->FieldValue;
 $items[] = $value;
 }
 
$items = implode("\n", $items);
 
return $items;
//</code>
Don't forget to change the form's id and the name of the field from which you want to retrieve values.
My help is not official customer support. To receive your support, submit a ticket by clicking here
Last Edit: 10 years 9 months ago by cosmin.cristea.
The administrator has disabled public write access.

get submitted value 10 years 9 months ago #28252

  • djseleco
  • djseleco's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 47
  • Thank you received: 10
Thanks Cosmin, but unfortunately |Please Select[c] not appear :(
Last Edit: 10 years 9 months ago by djseleco.
The administrator has disabled public write access.

get submitted value 10 years 9 months ago #28323

  • siboyz
  • siboyz's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Anyone can help me please... :(

I want to create drop down menu like :

1-KAS
11-AKTIVA
111-BANK

But the result on dropdown menu like this:

|Please Select[c]KAS|KAS1|1AKTIVA|AKTIVA11|11BANK|BANK111|111

How to correct the code?
And this is my code below:



//<code>
$items = array();
$db = JFactory::getDbo();
$items[] = "|Please Select[c]";
$db->setQuery("SELECT FieldValue FROM #__rsform_submission_values WHERE FieldName IN ('accountno', 'accountname')
ORDER BY SubmissionId
LIMIT 100
");
$results = $db->loadObjectList();

foreach ($results as $result) {
$value = $result->FieldValue;
$label = $result->FieldValue;
$items[] = $value.'|'.$label;
}
$items = implode ("\n", $items);
return $items;
//</code>
The administrator has disabled public write access.

get submitted value 10 years 9 months ago #28329

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
This is not a copy paste solution, however you can work on the code I corrected below
//<code>
$items = array();
$db = JFactory::getDbo();
$items[] = "|Please Select[c]";
$db->setQuery("SELECT accountno, accountname FROM #__rsform_submission_values");
$results = $db->loadObjectList();
 
foreach ($results as $result) {
$value = $result->accountno;
$label = $result->accountname;
$items[] = $value.'|'.$label;
}
$items = implode ("\n", $items);
return $items;
//</code>

More information here:
http://www.rsjoomla.com/support/documentation/view-article/94-auto-populate-a-list-from-a-table.html

Information on PHP scripts can be found here:
http://www.rsjoomla.com/support/documentation/view-article/76-custom-php-code.html
http://www.rsjoomla.com/support/documentation/view-article/602-php-scripts.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.
The following user(s) said Thank You: siboyz

get submitted value 10 years 9 months ago #28339

  • siboyz
  • siboyz's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
This is the result in my form after i change wit your script:

|Please Select[c]accountno|accountnameaccountno|accountnameaccountno|accountnameaccountno|accountnameaccountno|accountnameaccountno|accountnameaccountno|accountnameaccountno|accountnameaccountno|accountnameaccountno|accountnameaccountno|accountnameaccountno|accountname

Still not working... :(
Do you have any different solution?
Thanks in advance..!!
The administrator has disabled public write access.

get submitted value 10 years 9 months ago #28340

  • siboyz
  • siboyz's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
I change the code like below:

$db->setQuery("SELECT FieldName, FieldValue FROM jomla.yfeuk_rsform_submission_values
WHERE FieldName IN ('accountno', 'accountname') GROUP BY FieldValue
ORDER BY SubmissionId LIMIT 100;");
$results = $db->loadObjectList();

foreach ($results as $result) {
$value = $result->FieldValue;
$label = $result->FieldValue;
$items[] = $value.'|'.$label;

An the result is:

Please Select
KAS
1
AKTIVA
11
BANK
111

How to populate them become:

1-KAS
11-AKTIVA
111-BANK

Thank you for the help
The administrator has disabled public write access.

get submitted value 10 years 9 months ago #28341

  • siboyz
  • siboyz's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
OK now my form running weel, this is the code:

SELECT `s`.`SubmissionId`,GROUP_CONCAT(IF(`sv`.`FieldName`='accountno', `sv`.`FieldValue`, NULL)) AS `accountno`,GROUP_CONCAT(IF(`sv`.`FieldName`='accountname', `sv`.`FieldValue`, NULL)) AS `accountname`
FROM `yfeuk_rsform_submission_values` AS `sv`
LEFT JOIN `yfeuk_rsform_submissions` AS `s`
ON (`sv`.`SubmissionId`=`s`.`SubmissionId`)
WHERE `s`.`FormId`='3'
GROUP BY `s`.`SubmissionId`
ORDER BY `SubmissionId` ASC

THANKS FOR YOR HELP COSMIN :)
The administrator has disabled public write access.

get submitted value 10 years 9 months ago #28367

  • kareez
  • kareez's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
Hi
I'm reading your post in:
www.rsjoomla.com/forum/37-rsform-pro/243...ted-value.html#28340

In this section:
OK now my form running weel, this is the code:
 
SELECT `s`.`SubmissionId`,GROUP_CONCAT(IF(`sv`.`FieldName`='accountno', `sv`.`FieldValue`, NULL)) AS `accountno`,GROUP_CONCAT(IF(`sv`.`FieldName`='accountname', `sv`.`FieldValue`, NULL)) AS `accountname`
 FROM `yfeuk_rsform_submission_values` AS `sv`
 LEFT JOIN `yfeuk_rsform_submissions` AS `s`
 ON (`sv`.`SubmissionId`=`s`.`SubmissionId`)
 WHERE `s`.`FormId`='3'
 GROUP BY `s`.`SubmissionId`
 ORDER BY `SubmissionId` ASC
 
THANKS FOR YOR HELP COSMIN

Can you help me in this link:
www.rsjoomla.com/forum/37-rsform-pro/243...in-dropdo.html#28364
Thanks
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!