1

I have two system config fields like password and password confirm field.i need to validate both are same. for this in my system.xml file i added <backend_model> note to both fields

 <backend_model>myextension/test</backend_model>

in my model folder i created Test.php class as below

class Mycomany_Myextension_Model_Test extends Mage_Core_Model_Config_Data
{


public function _afterSave()
    {
        $licence = $this->getValue(); //get the value from our config
        print_r($licence);
        die();

        return parent::_afterSave();
    }



}

EDIT

My system config values

<input id="filemaker_general_fburl" name="groups[general][fields][fburl][value]" value="test" class=" input-text" type="text">


<input id="filemaker_general_fbheight" name="groups[general][fields][fbheight][value]" value="123" class=" input-text" type="text">

but it only return one value instead of two.i don't know what is the issue?

2

$licence = $this->getValue(); return only current field value

Try following way to pick other value


$anotherValue = $this->getData('groups/[name_of_group]/fields/[name_of_field]/value');

example: echo $anotherValue = $this->getData('groups/general/fields/fbwidth/value');

  • it 's returning blank page <input id="filemaker_general_fbwidth" name="groups[general][fields][fbwidth][value]" value="abc" class=" input-text" type="text"> this is inspected code echo $anotherValue = $this->getData('groups/[general]/fields/[fbwidth]/value'); – srinath madusanka Apr 7 '16 at 8:10
  • check updated answer – Sohel Rana Apr 7 '16 at 8:25
1

Try this:

   $storeId = 2; // ID of the store you want to fetch the value of
   or
   $storeId = Mage::app()->getStore()->getStoreId();// Gets the current store's id

 echo $configValue = Mage::getStoreConfig('groups/general/fields/fbwidth/value', $storeId);
  • Please explain what your code is doing and how it is solving the OP's problem. "Code only" answers can be unclear to future readers that run into similar problems. – 7ochem Apr 7 '16 at 7:34
  • I have two system configuration fields.I need to validate bath fileds are same or not.but $licence = $this->getValue(); is give only one fields.i need to get both fields after save it – srinath madusanka Apr 7 '16 at 8:18
  • updated ans pls check now – Abdul Apr 7 '16 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.