• bm777
  • 0 Points
  • Member since 2017

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0
I am very new to SalesForce and I need help about the following situation: 
I have a form with some input fields about a custom object called Student, like name, Surname etc. On the same page below I have another form with a table and I want this table to save every single input record from the form above. What I managed to do is when I hit the button Save every current record is being saved in the table and not all records. 

I do not know how to proceed. Any help would be greatly appreciated!

VisualForce code: 

<apex:page controller="StudentController1">
 <apex:form id="form1">
  <apex:pageBlock title="Nov Student">
    <apex:pageBlockSection columns="1">
      <apex:inputField value="{!Student.Name}"/>
      <apex:inputField value="{!Student.Priimek__c}"/>
      <apex:inputField value="{!Student.Letnik__c}"/>
      <apex:inputField value="{!Student.Naslov__c}"/>
      <apex:inputField value="{!Student.Datum_rojstva__c}"/>
      <apex:inputField value="{!Student.Naziv_fakultete__c}"/>
      <apex:inputField value="{!Student.Studijski_program__c}"/>
      <apex:inputField value="{!Student.Tip_studija__c}"/>
<apex:selectcheckboxes layout="pagedirection">
      <apex:selectOption id="Placnik" itemValue="Samoplacnik" itemLabel="Samoplacnik" />

     <apex:pageBlock title="Vsi studenti">
      <apex:pageBlockTable value="{!Student}" var="wrapper" id="wtable" rows="9">
            <apex:column value="{!wrapper.Name}"/>      
            <apex:column value="{!wrapper.Priimek__c}"/>
            <apex:column value="{!wrapper.Naslov__c}"/>
            <apex:column value="{!wrapper.Datum_rojstva__c}"/>      
            <apex:column value="{!wrapper.Naziv_fakultete__c}"/>
            <apex:column value="{!wrapper.Studijski_program__c}"/>
            <apex:column value="{!wrapper.Letnik__c}"/>
            <apex:column value="{!wrapper.Tip_studija__c}"/>
 <apex:commandButton action="{!dodajStudent}" value="Save" id="theButton" reRender="wtable"/>

APEX code:

public class StudentController1 {

  public boolean showValue {get;set;}
  public string studentName {get;set;}
  public Student__c student {get;set;}
  public StudentController1(){
        student = new Student__c();
  public pageReference Save(){
        insert student; 
        return null;
  public void dodajStudent(){
        upsert student;
  public void updateFieldVisibility() {
        showValue = true;
  • September 15, 2017
  • Like
  • 0