function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
eworks123456eworks123456 

Share:I want to share field population functionality on dynamic selection with community

 

Visual Force Page Code:
<apex:page controller="TestFieldPopulationController" id="pg">
    <script type="text/javascript">
        function userInput(){
            var UInput=document.getElementById("{!$Component.pg.frm.in}").value;
            return UInput;
        }
        
    </script>
    
    <apex:form id="frm">
        <apex:actionFunction name="hitMe" action="{!iWantMyJSValues}" rerender="jsvalues">
            <apex:param name="one" value="" />
            <apex:param name="two" value="" />
            <apex:param name="three" value="" />
        </apex:actionFunction>
        
        <apex:outputPanel id="jsvalues">
            <apex:panelGrid columns="2">
                Value One:<apex:inputText id="in" value="{!valueOne}" onclick="hitMe(userInput(),'{!email}','{!state}' )"/>
                Value Two:<apex:inputText value="{!valueTwo}" />   
                Value Three:<apex:inputText value="{!valueThree}" />
            </apex:panelGrid>        
        </apex:outputPanel>
   </apex:form>
</apex:page>


Controller Code:

public class TestFieldPopulationController 
{
    public String valueOne { get; set; }
    public String valueTwo { get; set; }
    public String valueThree { get; set;}
    public String email{ get; set;}
    public String state{ get; set;}
    
    public PageReference iWantMyJSValues() 
    {
        valueOne = Apexpages.currentPage().getParameters().get('one');
        valueTwo = Apexpages.currentPage().getParameters().get('two');
        valueThree = Apexpages.currentPage().getParameters().get('three');
        email = [select Email__c from Employee_Detail__c where name =:valueOne].Email__c;
        state = [select State__c from Employee_Detail__c where name =:valueOne].State__c;
        return null;
    }
}


 

Value OneHello Team,

 

 

I want to share field population functionality with community so that none of us invest more time on R & D  work.

Scenario  is:

 

1. There are three fields in my visual force page(Value One, Value Two, Value Three).

2. Now whenever user will put value on "Value One" field  and click on that the values of other two fields will automatically get populated.

 

 

Hope this will helpful for all of you.

 

Regards,

Manoj Jain

 

 

 

jkucerajkucera

Thanks for sharing!