You need to sign in to do that
Don't have an account?
Christopher Peck 16
Passing URL parameter to managed picklist
I'm new to visualforce but trying to edit a page built by another. I need to set a picklist value, that can be changed on the form, to a value defined in the URL.
The URL that is pass includes:
?channel=email&market=1&lang=en
I'm trying to set the market picklist here:
<div class="new-subform-component form-group field">
<label for="select_market" class="control-label id="select_market">{!$Label.Select_Market}:</label>
<div>
<apex:inputField value="{!caseObj.Case_Market__c}"
Styleclass="form-control caseMarket" required="true" id="market" onchange="UpdateCountryCode()" />
</div>
</div>
This is pulling the options from the Case.Case_Market__c field. Each Market(Country) as an API value that is a number but of course the number is considered text type.
If I add an onload function:
window.onload=function() {
$('.caseMarket').val('1');
};
This works, 1 = USA
Anything refencing the URL parameter, doesn't work such as:
var xMarket = '{($CurrentPage.parameters.market == null, '1', $CurrentPage.parameters.market)}';
window.onload=function() {
if (xMarket == "1"){
$('.caseMarket').val('1');
} else if (xMarket == "2") {
$('.caseMarket').val('2');
}
UpdateCountryCode()
};
Or setting the .caseMarket by parameter on load:
window.onload=function() {
$('.caseMarket').val('$CurrentPage.parameters.market');
}
I have tried many, many different ways of doing this, all failing. Ideas?
The URL that is pass includes:
?channel=email&market=1&lang=en
I'm trying to set the market picklist here:
<div class="new-subform-component form-group field">
<label for="select_market" class="control-label id="select_market">{!$Label.Select_Market}:</label>
<div>
<apex:inputField value="{!caseObj.Case_Market__c}"
Styleclass="form-control caseMarket" required="true" id="market" onchange="UpdateCountryCode()" />
</div>
</div>
This is pulling the options from the Case.Case_Market__c field. Each Market(Country) as an API value that is a number but of course the number is considered text type.
If I add an onload function:
window.onload=function() {
$('.caseMarket').val('1');
};
This works, 1 = USA
Anything refencing the URL parameter, doesn't work such as:
var xMarket = '{($CurrentPage.parameters.market == null, '1', $CurrentPage.parameters.market)}';
window.onload=function() {
if (xMarket == "1"){
$('.caseMarket').val('1');
} else if (xMarket == "2") {
$('.caseMarket').val('2');
}
UpdateCountryCode()
};
Or setting the .caseMarket by parameter on load:
window.onload=function() {
$('.caseMarket').val('$CurrentPage.parameters.market');
}
I have tried many, many different ways of doing this, all failing. Ideas?
https://pradhanmantri-yogana.in/
So something like: