-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
9Replies
Javascript Popup on VF Page from Static Resource
Hello,
New to using JS, we have a need on a VisualForce page when the label of a pageBlockSectionItem is clicked, to execute a JS popup. In order to keep the code clean, I have put the JS in a seperate static resource. I am now trying to access a function for the onLabelClick and it is not working. If I put the <script> tags in the VF page and invoke the fuction onLabelclick it works, but is there a way to avoid that?
Below is the VF code I have that is not working:
New to using JS, we have a need on a VisualForce page when the label of a pageBlockSectionItem is clicked, to execute a JS popup. In order to keep the code clean, I have put the JS in a seperate static resource. I am now trying to access a function for the onLabelClick and it is not working. If I put the <script> tags in the VF page and invoke the fuction onLabelclick it works, but is there a way to avoid that?
Below is the VF code I have that is not working:
<apex:page standardController="QA__c"> <apex:includeScript value="{!$Resource.QA_Javascript}"/> <apex:form > <apex:pageMessages /> <apex:pageBlock title="QA Scoring Form"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save" /> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:actionRegion > <apex:pageblockSection title="QA Information"> <apex:inputField value="{!QA__c.Reviewee__c}"/> <apex:inputField value="{!QA__c.Complexity__c}"/> <apex:inputField value="{!QA__c.QA_Quote_Number__c}"/> <apex:inputField value="{!QA__c.QA_Date__c}"/> <apex:inputField value="{!QA__c.Overall_Comments__c}"/> </apex:pageblockSection> <apex:pageBlockSection title="Phone Etiquette" id="pe"> <apex:pageBlockSectionItem onLabelclick="appGreet();" > <apex:outputLabel value="Appropriate Greeting" for="ag1"/> <apex:panelGrid columns="2"> <apex:inputField value="{!QA__c.Appropriate_Greeting__c}" id="ag1"> <apex:actionSupport event="onchange" reRender="pe"/> </apex:inputfield> <apex:inputField value="{!QA__c.App_Greet_Comment__c}" id="ag2" label="Comments"/> </apex:panelGrid> </apex:pageBlockSectionItem>
-
- George M Albrecht
- October 07, 2014
- Like
- 0
- Continue reading or reply
Set Selected Value of Custom VF Picklist to Field on Record Save
Hello,
We have built a custom picklist using SOQL on a VF page. However, we need a way to take the value that a user selected and set that to a value of a field on our object. Below is the code sample. We are trying to set the values of select list "award" and select list "denom" to two fields on our custom object.
We have built a custom picklist using SOQL on a VF page. However, we need a way to take the value that a user selected and set that to a value of a field on our object. Below is the code sample. We are trying to set the values of select list "award" and select list "denom" to two fields on our custom object.
public class employeeAwardPicklist { public string atype{get; set;} public string award{get; set;} // Added awards as public variable, removed the getter. public List<SelectOption> awards {get;set;} public string denom{get; set;} // Denomination list added for picklist public List<SelectOption> denoms {get;set;} public employeeAwardPicklist(ApexPages.StandardController controller) { } //The type of giftcard for the first picklist option public list<selectoption> gettypes(){ list<selectoption> options= new list<selectoption>(); list<AggregateResult> atype= [select Type__c from Awards__c group by type__c order by type__c]; options.add(new selectoption('', '--Select CardType--')); for(AggregateResult t:atype){ options.add(new selectoption(String.valueof(t.get('type__c')), String.valueof(t.get('type__c')))); } return options; } // Use this method to get the 2nd picklist populated. This method is called everytime the first picklist is changed. public void calculateAwards(){ awards = new List<SelectOption>(); if(atype == null || atype == ''){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Select a Card Type')); return; } list<Awards__c> award= [SELECT name FROM Awards__c WHERE Awards__c.type__c =:atype]; awards.add(new selectoption('—-Select Award—-', '—-Select Award—-')); for( Awards__c a:award){ awards.add(new selectoption(a.name,a.name)); } } //The denomination amount for the third picklist option. This method is called everytime that the second picklist is changed. public void calculateDenoms(){ denoms = new List<SelectOption>(); if(award == null || award == ''){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Select an Award')); return; } list<Awards__c> denom= [SELECT Denomination__c FROM Awards__c WHERE Awards__c.name=:award]; denoms.add(new selectoption('—-Select Denomination—-', '—-Select Denomination—-')); for( Awards__c d:denom){ denoms.add(new selectoption(d.denomination__c,d.denomination__c)); } } } <apex:pageBlockSection title="Award Details" columns="2" > <!--First picklist option Gift Card Type --> <apex:pageBlockSectionItem > <apex:outputLabel value="Gift Card Type"/> <apex:outputPanel styleClass="requiredInput" layout="block"> <apex:outputPanel styleClass="requiredInput" layout="block"/> <apex:selectList size="1" value="{!atype}" > <apex:selectOptions value="{!types}" /> <apex:actionSupport event="onchange" action="{!calculateAwards}" reRender="award"/> </apex:selectList> </apex:outputPanel> </apex:pageBlockSectionItem> <!--Second picklist option Award Name --> <apex:pageBlockSectionItem > <apex:outputLabel value="Award"/> <apex:selectList size="1" value="{!award}" id="awardList" > <apex:selectOptions value="{!awards}" /> <apex:actionSupport event="onchange" action="{!calculateDenoms}" reRender="award"/> </apex:selectList> </apex:pageBlockSectionItem> <!--Third picklist value Denomination --> <apex:pageBlockSectionItem > <apex:outputLabel value="Denomination" /> <apex:selectList size="1" value="{!denom}" id="denoms"> <apex:selectOptions value="{!denoms}"/> </apex:selectList> </apex:pageBlockSectionItem> <apex:inputField value="{!Employee_Awards__c.Award_Term__c}" /> <apex:inputField value="{!Employee_Awards__c.Award_Reason__c}" /> <apex:inputField value="{!Employee_Awards__c.Gift_Card_Serial_Number__c}" /> <apex:outputLink style="margin-left:130px" value="https://plymouthrock--SQA.cs9.my.salesforce.com/sfc/p/K000000W3om0/a/K000000002V6/0XwKI_QQteWq11TJ0JClkACGK6gUU9AqOnBRw5ABAD4=" styleClass="bold" target="_blank" id="giftCardSheet">Available Gift Cards</apex:outputLink> </apex:pageBlockSection>
-
- George M Albrecht
- August 12, 2014
- Like
- 0
- Continue reading or reply
Dynamic Dependent VF Page
Hello,
Trying to create a dynamic picklist on a VF page, running into issue on second picklist value populating dynamically. Can someone please help determine if its my query that is wrong or if I am not refreshing the VF page correctly to update picklist? Below are code snips:
public class employeeAwardPicklist {
public string atype{get; set;}
public string award{get; set;}
public string denom{get; set;}
public employeeAwardPicklist(ApexPages.StandardController controller) { }
//The type of giftcard for the first picklist option
public list<selectoption> gettypes(){
list<selectoption> options= new list<selectoption>();
list<AggregateResult> atype= [select Type__c from Awards__c group by type__c order by type__c];
options.add(new selectoption('—-Select CardType—-', '--Select CardType--'));
for(AggregateResult t:atype){
options.add(new selectoption(String.valueof(t.get('type__c')), String.valueof(t.get('type__c'))));
}
return options;
}
//The gift card name for the second picklist option
public list<selectoption> getawards(){
list<selectoption> options= new list<selectoption>();
list<Awards__c> award= [SELECT name FROM Awards__c WHERE Awards__c.type__c =:atype];
options.add(new selectoption('—-Select Award—-', '—-Select Award—-'));
for( Awards__c a:award){
options.add(new selectoption(a.name,a.name));
}
return options;
}
VF PAGE Section
<apex:pageBlock title="Employee Awards Edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Information">
<apex:inputField value="{!Employee_Awards__c.Employee__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Award Details" columns="2" >
<!--First picklist option Gift Card Type -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Gift Card Type"/>
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredInput" layout="block"/>
<apex:selectList size="1" value="{!atype}" >
<apex:selectOptions value="{!types}" />
<apex:actionSupport event="onchange" reRender="award"/>
</apex:selectList>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<!--Second picklist option Award Name -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Award"/>
<apex:selectList size="1" value="{!award}" id="award" >
<apex:selectOptions value="{!awards}" />
<apex:actionSupport event="onchange" reRender="denoms"/>
</apex:selectList>
</apex:pageBlockSectionItem>
Trying to create a dynamic picklist on a VF page, running into issue on second picklist value populating dynamically. Can someone please help determine if its my query that is wrong or if I am not refreshing the VF page correctly to update picklist? Below are code snips:
public class employeeAwardPicklist {
public string atype{get; set;}
public string award{get; set;}
public string denom{get; set;}
public employeeAwardPicklist(ApexPages.StandardController controller) { }
//The type of giftcard for the first picklist option
public list<selectoption> gettypes(){
list<selectoption> options= new list<selectoption>();
list<AggregateResult> atype= [select Type__c from Awards__c group by type__c order by type__c];
options.add(new selectoption('—-Select CardType—-', '--Select CardType--'));
for(AggregateResult t:atype){
options.add(new selectoption(String.valueof(t.get('type__c')), String.valueof(t.get('type__c'))));
}
return options;
}
//The gift card name for the second picklist option
public list<selectoption> getawards(){
list<selectoption> options= new list<selectoption>();
list<Awards__c> award= [SELECT name FROM Awards__c WHERE Awards__c.type__c =:atype];
options.add(new selectoption('—-Select Award—-', '—-Select Award—-'));
for( Awards__c a:award){
options.add(new selectoption(a.name,a.name));
}
return options;
}
VF PAGE Section
<apex:pageBlock title="Employee Awards Edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Information">
<apex:inputField value="{!Employee_Awards__c.Employee__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Award Details" columns="2" >
<!--First picklist option Gift Card Type -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Gift Card Type"/>
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredInput" layout="block"/>
<apex:selectList size="1" value="{!atype}" >
<apex:selectOptions value="{!types}" />
<apex:actionSupport event="onchange" reRender="award"/>
</apex:selectList>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<!--Second picklist option Award Name -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Award"/>
<apex:selectList size="1" value="{!award}" id="award" >
<apex:selectOptions value="{!awards}" />
<apex:actionSupport event="onchange" reRender="denoms"/>
</apex:selectList>
</apex:pageBlockSectionItem>
-
- George M Albrecht
- August 08, 2014
- Like
- 0
- Continue reading or reply
Post To Chatter by Email via Workflow Rule
Hi Developers,
Need some direction here. We have an approval process setup in our org and business has requested that on final approval, a post is automatically posted to chatter, notifying everyone of the approval. The thought process on our end (trying to avoid APEX), was to create an Email Alert action on Approval and use the Post to Chatter by Email functionality from Spring '14 to accomplish this post to Chatter. However, this is not working properly. The other email address from this email alert are receiving the email and we can see that the Chatter Group's email address is copied in these emails, but no posts are being generated to chatter.
Any ideas on what I'm missing/doing wrong or is this not possible? Thanks!
Need some direction here. We have an approval process setup in our org and business has requested that on final approval, a post is automatically posted to chatter, notifying everyone of the approval. The thought process on our end (trying to avoid APEX), was to create an Email Alert action on Approval and use the Post to Chatter by Email functionality from Spring '14 to accomplish this post to Chatter. However, this is not working properly. The other email address from this email alert are receiving the email and we can see that the Chatter Group's email address is copied in these emails, but no posts are being generated to chatter.
Any ideas on what I'm missing/doing wrong or is this not possible? Thanks!
-
- George M Albrecht
- July 29, 2014
- Like
- 0
- Continue reading or reply
Rerendered Inputfield Label Not Displaying (VF)
Hello,
I am trying have an inputfield render based upon what a user selects on another picklist field. The new field is rendering, but blank with no label. Here is the code I have so far..I am missing something simple?
<apex:pageBlockSection columns="3" title="What is this?">
<apex:inputField value="{!Bug_Enhancement__c.Request_Status__c}"/>
<apex:inputField value="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c}" label="Is this a New Article or Update to an Existing?">
<apex:actionSupport event="onchange" reRender="updateinfo"/>
</apex:inputField>
<apex:outputPanel id="updateinfo">
<apex:inputField value="{!Bug_Enhancement__c.Article_Number__c}" label="Article Number?" rendered="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c =='Update'}"/>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="What categories should we tag this article in?" >
</apex:pageBlockSection>
</apex:actionRegion>
I am trying have an inputfield render based upon what a user selects on another picklist field. The new field is rendering, but blank with no label. Here is the code I have so far..I am missing something simple?
<apex:pageBlockSection columns="3" title="What is this?">
<apex:inputField value="{!Bug_Enhancement__c.Request_Status__c}"/>
<apex:inputField value="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c}" label="Is this a New Article or Update to an Existing?">
<apex:actionSupport event="onchange" reRender="updateinfo"/>
</apex:inputField>
<apex:outputPanel id="updateinfo">
<apex:inputField value="{!Bug_Enhancement__c.Article_Number__c}" label="Article Number?" rendered="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c =='Update'}"/>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="What categories should we tag this article in?" >
</apex:pageBlockSection>
</apex:actionRegion>
-
- George M Albrecht
- June 23, 2014
- Like
- 0
- Continue reading or reply
Javascript Popup on VF Page from Static Resource
Hello,
New to using JS, we have a need on a VisualForce page when the label of a pageBlockSectionItem is clicked, to execute a JS popup. In order to keep the code clean, I have put the JS in a seperate static resource. I am now trying to access a function for the onLabelClick and it is not working. If I put the <script> tags in the VF page and invoke the fuction onLabelclick it works, but is there a way to avoid that?
Below is the VF code I have that is not working:
New to using JS, we have a need on a VisualForce page when the label of a pageBlockSectionItem is clicked, to execute a JS popup. In order to keep the code clean, I have put the JS in a seperate static resource. I am now trying to access a function for the onLabelClick and it is not working. If I put the <script> tags in the VF page and invoke the fuction onLabelclick it works, but is there a way to avoid that?
Below is the VF code I have that is not working:
<apex:page standardController="QA__c"> <apex:includeScript value="{!$Resource.QA_Javascript}"/> <apex:form > <apex:pageMessages /> <apex:pageBlock title="QA Scoring Form"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save" /> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:actionRegion > <apex:pageblockSection title="QA Information"> <apex:inputField value="{!QA__c.Reviewee__c}"/> <apex:inputField value="{!QA__c.Complexity__c}"/> <apex:inputField value="{!QA__c.QA_Quote_Number__c}"/> <apex:inputField value="{!QA__c.QA_Date__c}"/> <apex:inputField value="{!QA__c.Overall_Comments__c}"/> </apex:pageblockSection> <apex:pageBlockSection title="Phone Etiquette" id="pe"> <apex:pageBlockSectionItem onLabelclick="appGreet();" > <apex:outputLabel value="Appropriate Greeting" for="ag1"/> <apex:panelGrid columns="2"> <apex:inputField value="{!QA__c.Appropriate_Greeting__c}" id="ag1"> <apex:actionSupport event="onchange" reRender="pe"/> </apex:inputfield> <apex:inputField value="{!QA__c.App_Greet_Comment__c}" id="ag2" label="Comments"/> </apex:panelGrid> </apex:pageBlockSectionItem>
- George M Albrecht
- October 07, 2014
- Like
- 0
- Continue reading or reply
actionRegion hides my field name
Hi I have tried to put the actionregion between pageBlockSectionItem. But it is still not showing my label. I'm not sure what else to try. I have tried researching but nothing helps. PLEASE PLEASE someone help. This is a little urgent.
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:actionRegion >
<apex:inputField value="{!Contact.Contact_Type__c}" id="stage">
<apex:actionSupport event="onchange" rerender="thePageBlock" status="status"/>
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:actionRegion >
<apex:inputField value="{!Contact.Contact_Type__c}" id="stage">
<apex:actionSupport event="onchange" rerender="thePageBlock" status="status"/>
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
- Semira@gmail.com
- August 18, 2014
- Like
- 0
- Continue reading or reply
Set Selected Value of Custom VF Picklist to Field on Record Save
Hello,
We have built a custom picklist using SOQL on a VF page. However, we need a way to take the value that a user selected and set that to a value of a field on our object. Below is the code sample. We are trying to set the values of select list "award" and select list "denom" to two fields on our custom object.
We have built a custom picklist using SOQL on a VF page. However, we need a way to take the value that a user selected and set that to a value of a field on our object. Below is the code sample. We are trying to set the values of select list "award" and select list "denom" to two fields on our custom object.
public class employeeAwardPicklist { public string atype{get; set;} public string award{get; set;} // Added awards as public variable, removed the getter. public List<SelectOption> awards {get;set;} public string denom{get; set;} // Denomination list added for picklist public List<SelectOption> denoms {get;set;} public employeeAwardPicklist(ApexPages.StandardController controller) { } //The type of giftcard for the first picklist option public list<selectoption> gettypes(){ list<selectoption> options= new list<selectoption>(); list<AggregateResult> atype= [select Type__c from Awards__c group by type__c order by type__c]; options.add(new selectoption('', '--Select CardType--')); for(AggregateResult t:atype){ options.add(new selectoption(String.valueof(t.get('type__c')), String.valueof(t.get('type__c')))); } return options; } // Use this method to get the 2nd picklist populated. This method is called everytime the first picklist is changed. public void calculateAwards(){ awards = new List<SelectOption>(); if(atype == null || atype == ''){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Select a Card Type')); return; } list<Awards__c> award= [SELECT name FROM Awards__c WHERE Awards__c.type__c =:atype]; awards.add(new selectoption('—-Select Award—-', '—-Select Award—-')); for( Awards__c a:award){ awards.add(new selectoption(a.name,a.name)); } } //The denomination amount for the third picklist option. This method is called everytime that the second picklist is changed. public void calculateDenoms(){ denoms = new List<SelectOption>(); if(award == null || award == ''){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Select an Award')); return; } list<Awards__c> denom= [SELECT Denomination__c FROM Awards__c WHERE Awards__c.name=:award]; denoms.add(new selectoption('—-Select Denomination—-', '—-Select Denomination—-')); for( Awards__c d:denom){ denoms.add(new selectoption(d.denomination__c,d.denomination__c)); } } } <apex:pageBlockSection title="Award Details" columns="2" > <!--First picklist option Gift Card Type --> <apex:pageBlockSectionItem > <apex:outputLabel value="Gift Card Type"/> <apex:outputPanel styleClass="requiredInput" layout="block"> <apex:outputPanel styleClass="requiredInput" layout="block"/> <apex:selectList size="1" value="{!atype}" > <apex:selectOptions value="{!types}" /> <apex:actionSupport event="onchange" action="{!calculateAwards}" reRender="award"/> </apex:selectList> </apex:outputPanel> </apex:pageBlockSectionItem> <!--Second picklist option Award Name --> <apex:pageBlockSectionItem > <apex:outputLabel value="Award"/> <apex:selectList size="1" value="{!award}" id="awardList" > <apex:selectOptions value="{!awards}" /> <apex:actionSupport event="onchange" action="{!calculateDenoms}" reRender="award"/> </apex:selectList> </apex:pageBlockSectionItem> <!--Third picklist value Denomination --> <apex:pageBlockSectionItem > <apex:outputLabel value="Denomination" /> <apex:selectList size="1" value="{!denom}" id="denoms"> <apex:selectOptions value="{!denoms}"/> </apex:selectList> </apex:pageBlockSectionItem> <apex:inputField value="{!Employee_Awards__c.Award_Term__c}" /> <apex:inputField value="{!Employee_Awards__c.Award_Reason__c}" /> <apex:inputField value="{!Employee_Awards__c.Gift_Card_Serial_Number__c}" /> <apex:outputLink style="margin-left:130px" value="https://plymouthrock--SQA.cs9.my.salesforce.com/sfc/p/K000000W3om0/a/K000000002V6/0XwKI_QQteWq11TJ0JClkACGK6gUU9AqOnBRw5ABAD4=" styleClass="bold" target="_blank" id="giftCardSheet">Available Gift Cards</apex:outputLink> </apex:pageBlockSection>
- George M Albrecht
- August 12, 2014
- Like
- 0
- Continue reading or reply
Dynamic Dependent VF Page
Hello,
Trying to create a dynamic picklist on a VF page, running into issue on second picklist value populating dynamically. Can someone please help determine if its my query that is wrong or if I am not refreshing the VF page correctly to update picklist? Below are code snips:
public class employeeAwardPicklist {
public string atype{get; set;}
public string award{get; set;}
public string denom{get; set;}
public employeeAwardPicklist(ApexPages.StandardController controller) { }
//The type of giftcard for the first picklist option
public list<selectoption> gettypes(){
list<selectoption> options= new list<selectoption>();
list<AggregateResult> atype= [select Type__c from Awards__c group by type__c order by type__c];
options.add(new selectoption('—-Select CardType—-', '--Select CardType--'));
for(AggregateResult t:atype){
options.add(new selectoption(String.valueof(t.get('type__c')), String.valueof(t.get('type__c'))));
}
return options;
}
//The gift card name for the second picklist option
public list<selectoption> getawards(){
list<selectoption> options= new list<selectoption>();
list<Awards__c> award= [SELECT name FROM Awards__c WHERE Awards__c.type__c =:atype];
options.add(new selectoption('—-Select Award—-', '—-Select Award—-'));
for( Awards__c a:award){
options.add(new selectoption(a.name,a.name));
}
return options;
}
VF PAGE Section
<apex:pageBlock title="Employee Awards Edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Information">
<apex:inputField value="{!Employee_Awards__c.Employee__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Award Details" columns="2" >
<!--First picklist option Gift Card Type -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Gift Card Type"/>
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredInput" layout="block"/>
<apex:selectList size="1" value="{!atype}" >
<apex:selectOptions value="{!types}" />
<apex:actionSupport event="onchange" reRender="award"/>
</apex:selectList>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<!--Second picklist option Award Name -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Award"/>
<apex:selectList size="1" value="{!award}" id="award" >
<apex:selectOptions value="{!awards}" />
<apex:actionSupport event="onchange" reRender="denoms"/>
</apex:selectList>
</apex:pageBlockSectionItem>
Trying to create a dynamic picklist on a VF page, running into issue on second picklist value populating dynamically. Can someone please help determine if its my query that is wrong or if I am not refreshing the VF page correctly to update picklist? Below are code snips:
public class employeeAwardPicklist {
public string atype{get; set;}
public string award{get; set;}
public string denom{get; set;}
public employeeAwardPicklist(ApexPages.StandardController controller) { }
//The type of giftcard for the first picklist option
public list<selectoption> gettypes(){
list<selectoption> options= new list<selectoption>();
list<AggregateResult> atype= [select Type__c from Awards__c group by type__c order by type__c];
options.add(new selectoption('—-Select CardType—-', '--Select CardType--'));
for(AggregateResult t:atype){
options.add(new selectoption(String.valueof(t.get('type__c')), String.valueof(t.get('type__c'))));
}
return options;
}
//The gift card name for the second picklist option
public list<selectoption> getawards(){
list<selectoption> options= new list<selectoption>();
list<Awards__c> award= [SELECT name FROM Awards__c WHERE Awards__c.type__c =:atype];
options.add(new selectoption('—-Select Award—-', '—-Select Award—-'));
for( Awards__c a:award){
options.add(new selectoption(a.name,a.name));
}
return options;
}
VF PAGE Section
<apex:pageBlock title="Employee Awards Edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Information">
<apex:inputField value="{!Employee_Awards__c.Employee__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Award Details" columns="2" >
<!--First picklist option Gift Card Type -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Gift Card Type"/>
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredInput" layout="block"/>
<apex:selectList size="1" value="{!atype}" >
<apex:selectOptions value="{!types}" />
<apex:actionSupport event="onchange" reRender="award"/>
</apex:selectList>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<!--Second picklist option Award Name -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="Award"/>
<apex:selectList size="1" value="{!award}" id="award" >
<apex:selectOptions value="{!awards}" />
<apex:actionSupport event="onchange" reRender="denoms"/>
</apex:selectList>
</apex:pageBlockSectionItem>
- George M Albrecht
- August 08, 2014
- Like
- 0
- Continue reading or reply
Rerendered Inputfield Label Not Displaying (VF)
Hello,
I am trying have an inputfield render based upon what a user selects on another picklist field. The new field is rendering, but blank with no label. Here is the code I have so far..I am missing something simple?
<apex:pageBlockSection columns="3" title="What is this?">
<apex:inputField value="{!Bug_Enhancement__c.Request_Status__c}"/>
<apex:inputField value="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c}" label="Is this a New Article or Update to an Existing?">
<apex:actionSupport event="onchange" reRender="updateinfo"/>
</apex:inputField>
<apex:outputPanel id="updateinfo">
<apex:inputField value="{!Bug_Enhancement__c.Article_Number__c}" label="Article Number?" rendered="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c =='Update'}"/>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="What categories should we tag this article in?" >
</apex:pageBlockSection>
</apex:actionRegion>
I am trying have an inputfield render based upon what a user selects on another picklist field. The new field is rendering, but blank with no label. Here is the code I have so far..I am missing something simple?
<apex:pageBlockSection columns="3" title="What is this?">
<apex:inputField value="{!Bug_Enhancement__c.Request_Status__c}"/>
<apex:inputField value="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c}" label="Is this a New Article or Update to an Existing?">
<apex:actionSupport event="onchange" reRender="updateinfo"/>
</apex:inputField>
<apex:outputPanel id="updateinfo">
<apex:inputField value="{!Bug_Enhancement__c.Article_Number__c}" label="Article Number?" rendered="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c =='Update'}"/>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="What categories should we tag this article in?" >
</apex:pageBlockSection>
</apex:actionRegion>
- George M Albrecht
- June 23, 2014
- Like
- 0
- Continue reading or reply