• 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: Post form to another user

Post form to another user 11 years 5 months ago #25645

  • nytweb
  • nytweb's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Hey there

I have created a form, and there is a drop down menu were the poster selects a user, i am using this code to achieve this:

//<code>
$db =& JFactory::getDBO();
$db->setQuery("SELECT `id`,`name`,`email` FROM #__users LEFT JOIN #__user_usergroup_map ON #__users.id=#__user_usergroup_map.user_id WHERE #__user_usergroup_map.group_id=11");
$results = $db->loadObjectList();
$items[] = "|Vælg venligst";
foreach ($results as $res){
$value = $res->id;
$label = $res->name;
$items[] = $value.'|'.$label;
}
return implode("\n",$items);
//</code>

How can I make it so, that the form gets posted to the user selected with the above?

In plain language... I have a Doctor / Patient system... The doctor posts data to the system via the form and selects the patient in the drop down. The patient cant post any data. But she can see the form posted by the doctor when she visits her own personal page.

Hope someone can help me, I´m a designer not a programmer :P
The administrator has disabled public write access.

Post form to another user 11 years 5 months ago #25648

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

Since you are also getting the user's ID from the database, you can try using the following approach:

- a script will be needed within the "Scripts called on form process area" that will update the "#__rsform_submissions" table based on the user ID from the dropdown's selection for that submission.

More information on the RSForm!Pro PHP scripting areas can be found here:

www.rsjoomla.com/support/documentation/v...602-php-scripts.html

- you can use the "Directory Submission" menu item(added in the latest revision of the component) and show only the logged in user's submissions:

www.rsjoomla.com/support/documentation/v...age-directories.html

Basically, when the form is submitted, if everything is done correctly, this will act as if the user submitted that form and will be able to see the submission via the above menu item.
This is not official customer support. To receive your support, submit a support ticket here.
The administrator has disabled public write access.

Post form to another user 11 years 5 months ago #25673

  • nytweb
  • nytweb's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Hey

I have tried my best, had a PHP programer to look at it as well. But no luck...

We cant figure out how to make sure that userId gets set to the values selected in the drop down of the form. So that the form is posted as the selected user, and not the actual user posting.
The administrator has disabled public write access.

Post form to another user 11 years 5 months ago #25674

  • nytweb
  • nytweb's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Finally fixed it... Here is how if anyone else need the same...

The code mentioned in my first post i put in a "Dropdown" component, named "patient"

Created an SQL Mapping, set it like this:

Update:

SET
UserId (text) = {patient:value}
WHERE
SubmissionId (int) 'Equals' = {global:submissionid}
Last Edit: 11 years 5 months ago by nytweb.
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!