I have a variable
$price = $this->item->extraFields->price->value;
in the item.php which is Joomla page detail template. In the same template, I load a form using RSForm component, so it's just {rsform 8}. In the form, you can set default values to its fields.
I want to set one of the fields' default value to be the $price - that's just an integer. So I followed this tutorial http://www.rsjoomla.com/support/documentation/view-article/369-get-the-page-title.html
and also this one http://www.rsjoomla.com/support/documentation/view-article/77-display-php-variables-by-default-when-form-is-shown.html (the same + SQL variant).
However, whenever I try to put there the default value, I don't succeed. I've been looking all around the internet for 3 hours so far and I just can't seem to do what I need.
So in my desperation, I tried different approaches to insert the variable into the form like the following...
//<code>
return $price;
//</code>
//<code>
$p = $price,
return $p;
//</code>
//<code>
echo $price;
//</code>
//<code>
print $price;
//</code>
//<code>
$price;
//</code>
None of them worked, of course. However, this one works:
//<code>
$price = 10;
return $price;
//</code>
I think the problem is that the template of the page (item.php) is somehow separated from the RSForm form template, but I don't really know.
Do you have any idea how to solve this issue? Another thing I'm gonna try is adding the variable there via JavaScript, but I'm not much into it as people can have JS off (and the field has to be filled no matter what), and I still can't be sure that it will be possible that way either.