Text Size

Login

[Corrected FAQ] Retrieving item data e.g. for use in RSforms

Use this forum to resolve problems and report bugs

[Corrected FAQ] Retrieving item data e.g. for use in RSforms

Postby arnaud.blain » Mon 23 Apr 2012 16:58

Hello,

I was using RS form in a flexicontent item and works fine until now.

I don't know if it's the fact I upgrade to FLEXIcontent version 1.5.6 RC4 (r1235) but now it doesn't give me the data I'm waited (mail and title)

I check this FAQ : http://www.flexicontent.org/documentati ... forms.html

also check if RS form plugin are enabled, all my flexicontent plugin are enabled too , I tried to use Sourcerer too but it doesn't work.

Instead having the data, i just have the code entered in default value RS Form field :

$db = & JFactory::getDBO(); $fcitem_id= JRequest::getInt('id',0); $view= JRequest::getVar('view'); if ($view!='items' && $view!='item' && $view!='article') { return "not in items view"; } // RETRIEVE item data if ($fcitem_id) { $query = 'SELECT c.* ' .'FROM '.'#'.'__content AS c ' .'WHERE c.id = ' . $fcitem_id; $db->setQuery($query); $itemdata = $db->loadObject(); $item_title = $itemdata->title; } // e.g. return $item_title;

thanks
arnaud.blain
Regular Member
 
Posts: 99
Joined: Sun 5 Dec 2010 15:47

Re: Retrieving item data e.g. for use in RSforms

Postby ggppdk » Mon 23 Apr 2012 17:09

I am not using the RSform but does it not have a option to specify that the value entered is PHP CODE that must be executed?

Trying checking out RSform FAQ
1. If you have problem logging in our forums, PLEASE CLEAR BROWSER cookies that have flexicontent.org (or ALL cookies or try a different browser)

2. FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks!
User avatar
ggppdk
Core Developer
Core Developer
 
Posts: 6575
Joined: Tue 14 Jun 2011 22:17
Location: Crete

Re: Retrieving item data e.g. for use in RSforms

Postby arnaud.blain » Tue 24 Apr 2012 00:38

in fact I had to add //<code> at the begining and //</code> at the end in the Default value of my hidden RS form pro.

So it works for title (basic field) but when I try to use a custom field (well, if email field is a custom field) i've got this error : Parse error: syntax error, unexpected '.' in /administrator/components/com_rsform/helpers/rsform.php(449) : eval()'d code on line 17

my code is exactly the same (with //<code> and //</code> this time) like FAQ : Retrieving the value of a custom field :

//<code>
$db = & JFactory::getDBO();
// Set a different item id if you don't want the current item ...
$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=19; // CHANGE THIS TO THE ID OF YOUR FIELD
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 = i.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;
//</code>
arnaud.blain
Regular Member
 
Posts: 99
Joined: Sun 5 Dec 2010 15:47

Re: Retrieving item data e.g. for use in RSforms

Postby ggppdk » Tue 24 Apr 2012 02:01

There is a redundant comma, i removed it from the FAQ article.

Change line:
.' ON f.item_id = i.id AND f.field_id='.(int)$field_id;
and remove the ending comma:
.' ON f.item_id = i.id AND f.field_id='.(int)$field_id

Regards
1. If you have problem logging in our forums, PLEASE CLEAR BROWSER cookies that have flexicontent.org (or ALL cookies or try a different browser)

2. FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks!
User avatar
ggppdk
Core Developer
Core Developer
 
Posts: 6575
Joined: Tue 14 Jun 2011 22:17
Location: Crete

Re: Retrieving item data e.g. for use in RSforms

Postby arnaud.blain » Wed 25 Apr 2012 10:51

Hello ggpdk,

thank you I didn't see that but it didn't work.
The error disappear but I don't get the data field.

There's something strange in the FAQ (title field name is used):

at the end it's written :

$db->setQuery($query);
$itemdata = $db->loadObject();
$item_title = $itemdata->title;
}
return $itemdata->value;


So I tried with my field name id:19 with is called courriel but it's the same, the return result is empty:

$db->setQuery($query);
$itemdata = $db->loadObject();
$item_email = $itemdata->courriel;
}
return $item_email;
//</code>


thanks
arnaud.blain
Regular Member
 
Posts: 99
Joined: Sun 5 Dec 2010 15:47

Re: Retrieving item data e.g. for use in RSforms

Postby arnaud.blain » Fri 27 Apr 2012 06:49

any idea ?

thanks
arnaud.blain
Regular Member
 
Posts: 99
Joined: Sun 5 Dec 2010 15:47

Re: Retrieving item data e.g. for use in RSforms

Postby arnaud.blain » Tue 8 May 2012 22:21

I'm sorry but the code in FAQ doesn't work for me:

I tried to get in RS field Default value email field and also text field but it get nothing :

//<code>
$db = & JFactory::getDBO();
// Set a different item id if you don't want the current item ...
$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=19; // CHANGE THIS TO THE ID OF YOUR FIELD
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 = i.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;
//</code>

best regards
arnaud.blain
Regular Member
 
Posts: 99
Joined: Sun 5 Dec 2010 15:47

Re: Retrieving item data e.g. for use in RSforms

Postby ggppdk » Tue 8 May 2012 22:47

Try changing
.' ON f.item_id = i.id AND f.field_id='.(int)$field_id
to
.' ON f.item_id = c.id AND f.field_id='.(int)$field_id
1. If you have problem logging in our forums, PLEASE CLEAR BROWSER cookies that have flexicontent.org (or ALL cookies or try a different browser)

2. FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks!
User avatar
ggppdk
Core Developer
Core Developer
 
Posts: 6575
Joined: Tue 14 Jun 2011 22:17
Location: Crete

Re: Retrieving item data e.g. for use in RSforms

Postby arnaud.blain » Wed 9 May 2012 07:46

the field is always empty
thanks
arnaud.blain
Regular Member
 
Posts: 99
Joined: Sun 5 Dec 2010 15:47

Re: Retrieving item data e.g. for use in RSforms

Postby ggppdk » Wed 9 May 2012 08:45

Ok put these lines at the top:

Code: Select all
error_reporting(E_ALL);
ini_set('display_errors', 1);


AND AFTER:
$itemdata = $db->loadObject();

Code: Select all
if ($db->getErrorNum()) {
   JError::raiseWarning(500, $db->getErrorMsg()."<br>Query:<br>".$query);
   return null;
}

to see if there is a DB query error,

also make sure the field id is correct
1. If you have problem logging in our forums, PLEASE CLEAR BROWSER cookies that have flexicontent.org (or ALL cookies or try a different browser)

2. FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks!
User avatar
ggppdk
Core Developer
Core Developer
 
Posts: 6575
Joined: Tue 14 Jun 2011 22:17
Location: Crete

Next

Return to Troubleshooting

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron