• aditya naidu
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I am tring to fetch multiple record and update them, but when ever i try to fetch the second record automatically the page get reefreshed and goes to the first row.
The code is:
visualforce page:
<apex:page controller="binsert">
<apex:form >
<apex:pageBlock title="bulk insert">
<apex:pageBlockButtons >
<apex:commandButton value="add row" action="{!addr}"/>
<apex:commandButton value="save row" action="{!saver}"/>
<apex:commandButton value="fetch" action="{!fetch}"/>
<apex:commandButton value="update" action="{!updat}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable var="bu" value="{!buk}">
<apex:column headerValue="Book Name">
<apex:inputField value="{!bu.name}"/>
</apex:column>
<apex:column headerValue="Book Author">
<apex:inputField value="{!bu.book_author__c}"/>
</apex:column>
<apex:column headerValue="Book Cost">
<apex:inputField value="{!bu.book_cost__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Controller class:
public class binsert {

    public PageReference updat() {
    update buk;
        return null;
    }


    public pagereference fetch() {
    buk=[select id,name,book_author__c,book_cost__c from book__c where name=:bo.name];
      return null;
    }


    public PageReference saver() {
    insert buk;
        return page.bulkinsert;
    }


    public PageReference addr() {
    book__c buuk=new book__c();
    buk.add(buuk);
            return null;
          
    }

book__c bo=new book__c();
public list<book__c> buk{get; set;}
public binsert(){
buk=new list<book__c>();
buk.add(bo);
}
}

can you please help me out to fetch multiple record and update.
Your suggestion is well appreciated.
Thank you!!
 
I am tring to fetch multiple record and update them, but when ever i try to fetch the second record automatically the page get reefreshed and goes to the first row.
The code is:
visualforce page:
<apex:page controller="binsert">
<apex:form >
<apex:pageBlock title="bulk insert">
<apex:pageBlockButtons >
<apex:commandButton value="add row" action="{!addr}"/>
<apex:commandButton value="save row" action="{!saver}"/>
<apex:commandButton value="fetch" action="{!fetch}"/>
<apex:commandButton value="update" action="{!updat}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable var="bu" value="{!buk}">
<apex:column headerValue="Book Name">
<apex:inputField value="{!bu.name}"/>
</apex:column>
<apex:column headerValue="Book Author">
<apex:inputField value="{!bu.book_author__c}"/>
</apex:column>
<apex:column headerValue="Book Cost">
<apex:inputField value="{!bu.book_cost__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Controller class:
public class binsert {

    public PageReference updat() {
    update buk;
        return null;
    }


    public pagereference fetch() {
    buk=[select id,name,book_author__c,book_cost__c from book__c where name=:bo.name];
      return null;
    }


    public PageReference saver() {
    insert buk;
        return page.bulkinsert;
    }


    public PageReference addr() {
    book__c buuk=new book__c();
    buk.add(buuk);
            return null;
          
    }

book__c bo=new book__c();
public list<book__c> buk{get; set;}
public binsert(){
buk=new list<book__c>();
buk.add(bo);
}
}

can you please help me out to fetch multiple record and update.
Your suggestion is well appreciated.
Thank you!!
 
I am tring to fetch multiple record and update them, but when ever i try to fetch the second record automatically the page get reefreshed and goes to the first row.
The code is:
visualforce page:
<apex:page controller="binsert">
<apex:form >
<apex:pageBlock title="bulk insert">
<apex:pageBlockButtons >
<apex:commandButton value="add row" action="{!addr}"/>
<apex:commandButton value="save row" action="{!saver}"/>
<apex:commandButton value="fetch" action="{!fetch}"/>
<apex:commandButton value="update" action="{!updat}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable var="bu" value="{!buk}">
<apex:column headerValue="Book Name">
<apex:inputField value="{!bu.name}"/>
</apex:column>
<apex:column headerValue="Book Author">
<apex:inputField value="{!bu.book_author__c}"/>
</apex:column>
<apex:column headerValue="Book Cost">
<apex:inputField value="{!bu.book_cost__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Controller class:
public class binsert {

    public PageReference updat() {
    update buk;
        return null;
    }


    public pagereference fetch() {
    buk=[select id,name,book_author__c,book_cost__c from book__c where name=:bo.name];
      return null;
    }


    public PageReference saver() {
    insert buk;
        return page.bulkinsert;
    }


    public PageReference addr() {
    book__c buuk=new book__c();
    buk.add(buuk);
            return null;
          
    }

book__c bo=new book__c();
public list<book__c> buk{get; set;}
public binsert(){
buk=new list<book__c>();
buk.add(bo);
}
}

can you please help me out to fetch multiple record and update.
Your suggestion is well appreciated.
Thank you!!