0
Q:

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>
0

New to Communities?

Join the community