Answers for "javascript in VF page assign values from javascript to Picklist in vf page"

0

javascript in VF page assign values from javascript to Picklist in vf page

<apex:page standardController="Account" recordSetVar="accounts">

<apex:form>
    <apex:pageBlock >
        <apex:pageBlockTable value="{! accounts }" var="a">
            <apex:column>
                <apex:inputField id="source"
                        value="{! a.AccountSource }"
                        onchange="handleChange('{! $Component.source }', '{! $Component.destination }')"/>
            </apex:column>
            <apex:column>
                <apex:outputText id="destination" value="{! a.Name }"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>

<script>
function handleChange(sourceId, destinationId) {
    console.log('sourceId=' + sourceId);
    console.log('destinationId=' + destinationId);
    var v = document.getElementById(sourceId).value;
    document.getElementById(destinationId).innerHTML = v;
}
</script>

</apex:page>
Posted by: Guest on May-02-2020

Code answers related to "javascript in VF page assign values from javascript to Picklist in vf page"

Code answers related to "Javascript"

Browse Popular Code Answers by Language