How to Get Value of Custom Form field inside CustomField in Joomla
In this article, we will learn: How to Get Value of Custom Form field inside CustomField file, may be in getInput() function to set selected value.
It is very simple trick, you don't have to use any factory class object(which is used to get posted field variables values). Just using $this object, all that custom field submitted attributes are ready to get values from. Here is code:
<?php $this->value; ?>
You will use this code to put inside getinput() method and thus perform appropriate functionality on it. So for my case, I did a search using custom field, I want to keep save its state. So here is my code:
<?php protected function getInput() { $data = $this->getLayoutData();
// Here this value is set to be as selected after search is made $data['value'] = $this->value; $data['options'] = $this->getOptions(); return $this->getRenderer($this->layout)->render($data); } ?>
Hope this helped.
Still need help! no problem, feel free to contact us Today