Hi,
Maybe I am stupid or simply not finding the right way to do it
Yes, I did see the FAQ
www.flexicontent.org/documentation/faq/7...rsforms.html#content
but getting confused somewhere!
I have also make some search in the forum and found this thread
www.flexicontent.org/forum/index.php?f=2...b_v=viewtopic#p24544
and this one as well
www.flexicontent.org/forum/index.php?f=3...v=viewtopic&start=10
.
All discussions are about the code to retrieve FC fields in RSForms but none of them is mentioning where to put the code! So, maybe with some screenshots and more details, this will help you to understand my current situation, which seems similar to all mention above, but I really can't make it alone!
Step 1: I have created a field in FC, an email type field and the field ID is 70.
Step 2: I have created a form in RSForm, in the form properties, there are two possible spaces where I could add the code:
First Possibility (Under the PHP Script dropdown see screenshot):
[attachment=1:1sv2tjt0]<!-- ia1 -->php_scripts_dropdown.jpg<!-- ia1 -->[/attachment:1sv2tjt0]
Second Possibility (Under the PHP Email Script dropdown see screenshot):
[attachment=0:1sv2tjt0]<!-- ia0 -->php_email_script.jpg<!-- ia0 -->[/attachment:1sv2tjt0]
Now about the code, I want to retrieve the email field from FC so that it is added to RSForm while sending the email so that the user who has created the item, added his email address and can receive inquiries sent through the form as well, and this is the code I got from the FAQ:
Code:
$db = & JFactory::getDBO();
$fcitem_id= JRequest::getInt('id',0);
$fccat_id= JRequest::getInt('cid',0);
$view= JRequest::getVar('view');
if ($view!='items' && $view!='item' && $view!='article') {
return "not in items view";
}
$field_id=70;
if ($fcitem_id) {
$query = 'SELECT c.title, c.alias, f.value'
.' FROM '.'#'.'__content AS c '
.' LEFT JOIN '.'#'.'__flexicontent_fields_item_relations AS f'
.' ON f.item_id = c.id AND f.field_id='.(int)$field_id
.' WHERE c.id = ' . $fcitem_id;
$db->setQuery($query);
$itemdata = $db->loadObject();
$item_title = $itemdata->title;
}
return $itemdata->value;
Note: I have removed the comments:
Code:
// Set a different item id if you don't want the current item ...
and
Code:
// CHANGE THIS TO THE ID OF YOUR FIELD
from the code and I have changed the field ID from 45 to 70 which is the ID of my email field in FC.
So, where should I place the code in RSForm and is the code the good one please?