javascript in vf page assign values from javascript to picklist in vf page

Solutions on MaxInterview for javascript in vf page assign values from javascript to picklist in vf page by the best coders in the world

showing results for - "javascript in vf page assign values from javascript to picklist in vf page"
Paola
06 May 2019
1<apex:page standardController="Account" recordSetVar="accounts">
2
3<apex:form>
4    <apex:pageBlock >
5        <apex:pageBlockTable value="{! accounts }" var="a">
6            <apex:column>
7                <apex:inputField id="source"
8                        value="{! a.AccountSource }"
9                        onchange="handleChange('{! $Component.source }', '{! $Component.destination }')"/>
10            </apex:column>
11            <apex:column>
12                <apex:outputText id="destination" value="{! a.Name }"/>
13            </apex:column>
14        </apex:pageBlockTable>
15    </apex:pageBlock>
16</apex:form>
17
18<script>
19function handleChange(sourceId, destinationId) {
20    console.log('sourceId=' + sourceId);
21    console.log('destinationId=' + destinationId);
22    var v = document.getElementById(sourceId).value;
23    document.getElementById(destinationId).innerHTML = v;
24}
25</script>
26
27</apex:page>