Get K2 Item Elements In RSFormPro Fields

There are very good reasons why one may need to collect data from a K2 page such as Item ID, Page Title, Page Alias, Page URL, Author, blah blah, in order to autofill fields within a RSFormPro form. Thanks to the excellent programming skills of the developers at RS Joomla, it's quite simple to achieve with Joomla's excellent framework hooks.

The code for each field output is entered in the Default Value field when creating the form field as shown in the image below.

Get the current page ID
return JFactory::getApplication()->input->getInt('id');
K2 Page ID
Invalid Input

Get the current page URL
return JUri::current();
Get K2 Page URL
Invalid Input

Get the current page title
$db = JFactory::getDbo();
->select( $db->quoteName('title') )
->from( $db->quoteName('#__k2_items') )
->where( $db->quoteName('id').'='.JFactory::getApplication()->input->getInt('id') )
return $db->loadResult();
K2 Page Title
Invalid Input



rsform get value coding

Monday, 09 October 2017 19:31  |   443 views


Copyright © 2018 All Rights Reserved.
This website is powered by the Joomla!©™ 3 Website Framework | File download and article manager component by K2 | Advanced Module Manager and Modules Anywhere by NoNumber Elements | Website hosting and development by WebsiteDons is owned and operated by Emuzement Net Inc, 4532 West Kennedy Blvd. Ste 180 33609 Tampa, Florida USA