You need to sign in to do that
Don't have an account?
Corey Edwards 11
Variable not being passed to Visualforce page
Hi Guys,
I'm trying to convert my logic from jQuery to an Apex controller. Based on the changing values of my Visualforce page I'd want to return the correct value for my variable. Here is my code:
When I call this value in Visualforce using an actionFunction it doesn't return a value. I've tested assigning values through the controller and this method works. I understand that the state of my Quote object has something to do with this but am struggling to find a solution.
Cheers
I'm trying to convert my logic from jQuery to an Apex controller. Based on the changing values of my Visualforce page I'd want to return the correct value for my variable. Here is my code:
public with sharing class getPriceExtension { //Set Standard Controller ApexPages.standardController m_sc = null; //Set Quote Instance public Quote quo{get;set;} //Set Global Variables String preHos = 'Premium Hospital', amb = 'Ambulance Only', firSta = 'First Start Hospital', fitHel = 'Fit & Healthy Hospital', pubHos = 'Public Hospital', smaHos = 'Smart Hospital', steUp = 'Step Up Hospital', valHos = 'Value Hospital', preExt = 'Premium Extras', smaExt = 'Smart Extras', valExt = 'Value Extras', fitExt = 'Fit & Healthy Extras', noHos = 'No Hospital', vicCor = 'Ambulance Victoria Corporate', vicRet = 'Ambulance Victoria Retail'; Public Integer finalValue{get;set;} //Constructor public getPriceExtension(ApexPages.standardController sc) { m_sc = sc; quo = (Quote)sc.getRecord(); } public Integer getHospitalId() { //Declare Locals String hospitalValue = quo.Hospital_Cover__c; String excess = quo.Excess__c; String levy = quo.Levy_Exempt__c; Integer f; //Logic //Premium Hospital if(hospitalValue == preHos) { if(excess == '$500'){ if(levy == 'Yes') { f = 30; } else{ f = 29; } } if(excess == '$250') { if(levy == 'Yes') { f = 9; } else { f = 5; } } if(excess == '$0') { if(levy == 'Yes') { f = 8; } else { f = 4; } } } //Smart Hospital if(hospitalValue == smaHos) { if(excess == '$500'){ if(levy == 'Yes') { f = 22; } else { f = 21; } } if(excess == '$250') { if(levy == 'Yes'){ f = 28; } else { f = 27; } } } //Step Up Hospital if(hospitalValue == steUp) { if(excess == '$500'){ if(levy == 'Yes') { f = 41; } else { f = 40; } } if(excess == '$250'){ if(levy == 'Yes') { f = 39; } else { f = 38; } } } //First Start Hospital if(hospitalValue == firSta) { if(excess == '$500'){ if(levy == 'Yes') { f = 45; } else { f = 44; } } if(excess == '$250'){ if(levy == 'Yes') { f = 43; } else { f = 42; } } } //Value Hospital if(hospitalValue == valHos) { if(excess == '$500'){ if(levy == 'Yes') { f = 26; } else { f = 25; } } if(excess == '$250'){ if(levy == 'Yes') { f = 24; } else { f = 23; } } } //Public Hospital if(hospitalValue == pubHos) { f = 3; } //No Hospital if(hospitalValue == noHos) { f = 0; } //Ambulance if(hospitalValue == amb) { f = 10; } //Fit & healthy if(hospitalValue == fitHel) { f = 6; } //Victoria Retail if(hospitalValue == vicRet) { f = 15; } //Victoria Corporate if(hospitalValue == vicCor) { f = 14; } finalValue = f; return finalValue; } }
When I call this value in Visualforce using an actionFunction it doesn't return a value. I've tested assigning values through the controller and this method works. I understand that the state of my Quote object has something to do with this but am struggling to find a solution.
Cheers
and calling this test function but it's not working:
Any help would be greatly appreciated :)
PLease check this once
Please try this once.