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
keshin okawakeshin okawa 

Add data in apex:pageBlockTable using jquery and get its data and send back to apex class

public class formBuilderClass {

        public Map<String,List<String>> objectFieldMap {
          get {
              if(objectFieldMap == null) {
                  objectFieldMap = new Map<String,List<String>>();
              return objectFieldMap;

        public void viewMap() {
            System.debug('wew objectFieldmap' + objectFieldMap);
And then I've created a visual force page that includes pageBlockTable and a script to insert data to the table which is something like this.
<apex:pageBlock >
      <apex:pageBlockTable value="{!objectFieldMap}" var="field" styleClass="table table-striped" id="tableField">
        <apex:column width="30%" value="{!objectFieldMap[field][0]}" headerValue="SALESFORCE FIELD" styleClass="wew" />
        <apex:column width="30%" value="{!objectFieldMap[field][1]}" headerValue="CSV FIELD" styleClass="wew" />

    <apex:commandButton value="Submit" action="{!viewMap}" styleClass="btn btn-block btn-strong-green"/>

        $('[id$="tableField"]').append('<tr><td>sample data 1</td><td>sample data 2</td></tr>') ;
What I want to accomplished, is that I want to get all the data appended to the table using javascript. So that, when I clicked the submit button I can see the new value for my objectFieldMap variable. Is it possible ? or are there any easier way to do a scenario which is something like this ? please help. Thank you...
Andy BoettcherAndy Boettcher
Using jQuery is going to add a few more steps for you.  If you were to use an ActionButton that had the CONTROLLER add a row to your table, that would be easy and you'd be done.

When you're doing this client-side, you'll need to serialize that table into an array and then pass that back via a RemoteAction to set that controller variable.