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
Jeremy DeseezJeremy Deseez 

Update are on all row and not the selected one

Hi SFDC,

I have a problem when I update some rows on my table, the update are made on all rows and not on the selected one.
<apex:pageBlockSection columns="4" id="allquotas">
<apex:pageBlockTable value="{!allthequotas}" id="table" var="key">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox" onchange="toggleCheckAll(this)"/> Select All
</apex:facet>
<apex:column>
<!-- <apex:inputCheckbox styleClass="selectInput"/> -->
<input type="checkbox" data-inputid="val1"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key.QuotaAmount}" required="false" id="val1"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!allthequotas2}" var="key2">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox2" onchange="toggleCheckAll2(this)"/> Select All
</apex:facet>
<apex:column>
<apex:inputCheckbox styleClass="selectInput2"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key2.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key2.QuotaAmount}" required="false" id="test"/>
</apex:column>
</apex:pageBlockTable> 
<apex:pageBlockTable value="{!allthequotas3}" var="key3">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox3" onchange="toggleCheckAll3(this)"/> Select All
</apex:facet>
<apex:column>
<apex:inputCheckbox styleClass="selectInput3"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key3.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key3.QuotaAmount}" required="false" id="test"/>
</apex:column>
</apex:pageBlockTable> 
<apex:pageBlockTable value="{!allthequotas4}" var="key4">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox4" onchange="toggleCheckAll4(this)"/> Select All
</apex:facet>
<apex:column>
<input type="checkbox" styleClass="selectInput4"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key4.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key4.QuotaAmount}" required="false" id="test"/>
</apex:column>
</apex:pageBlockTable> 
</apex:pageBlockSection>
</apex:pageBlock>

function copyQuotaAmount()
    {
        $("input[type=checkbox]:checked").each(function(){
            // $(this) refers to the current checked box in loop
            var inputid = $(this).data('inputid');
            console.log(inputid);

            var valuetocopy = $("input[id$='ValueToCopy']").val();
            console.log(valuetocopy);
            $("input[type='text'][id$='" + inputid + "']").val(valuetocopy);
            // $("input[type='text'][id$=inputid]").val(valuetocopy);
        });
    }