You need to sign in to do that
Don't have an account?
Nikita Yadav 17
Passing value from apex controller to Vf page
Apex controller -
public Boolean isAllowed {get;set;}
public void getCountries(){
isAllowed = false;
state=Apexpages.currentPage().getParameters().get('Fedstate');
system.debug('State on get Countries'+state);
countriesList = ExemptedCountriesList__c.getAll().values();
system.debug('countriesList '+countriesList);
for(ExemptedCountriesList__c names : countriesList){
system.debug('Names on '+names.name);
if(names.Name == state){
isAllowed = true;
system.debug('IsAllowed in If '+isAllowed);
}
}
}
vf page -
<script>
function openPopup(){
var allowed = document.getElementById('allowed').value;
console.log('allowed'+allowed);
}
</script>
<apex:inputHidden value = "{!isAllowed}" id = "allowed"/>
I am trying to aceess isAllowed variable of apex but it is always returning false even if it is true.Also suggest me th different ways to pass values from apex controller to VF page and access them in JS.
Please help me !! I am new to VF pages.
Thank you !
public Boolean isAllowed {get;set;}
public void getCountries(){
isAllowed = false;
state=Apexpages.currentPage().getParameters().get('Fedstate');
system.debug('State on get Countries'+state);
countriesList = ExemptedCountriesList__c.getAll().values();
system.debug('countriesList '+countriesList);
for(ExemptedCountriesList__c names : countriesList){
system.debug('Names on '+names.name);
if(names.Name == state){
isAllowed = true;
system.debug('IsAllowed in If '+isAllowed);
}
}
}
vf page -
<script>
function openPopup(){
var allowed = document.getElementById('allowed').value;
console.log('allowed'+allowed);
}
</script>
<apex:inputHidden value = "{!isAllowed}" id = "allowed"/>
I am trying to aceess isAllowed variable of apex but it is always returning false even if it is true.Also suggest me th different ways to pass values from apex controller to VF page and access them in JS.
Please help me !! I am new to VF pages.
Thank you !