+ Start a Discussion

Newbie saving data in a datatable

I have saved data before but not from a datatable, basically what i want to do is save each row of data as a new record in my object. Not sure how to do this. It displays the data exactly how i want it just need to save it. I really need some direction any help would be appreciated.


<apex:page standardController="Zones_List__c" extensions="RAPI"  showHeader="false" sidebar="false" standardStylesheets="false">
  <apex:outputPanel id="databox" >                   
    <apex:outputPanel id="dataPanel">     
       <apex:outputText value="{!DisplayZones}"  escape="false"/>
   <apex:form >
         <apex:commandButton id="ZoneUpdate" action="{!ZUpdateList}"  value="Update Zones" />
         <apex:inputText id="account_num" value="{!Zones_List__c.Account__c}"/>         
        <apex:pageBlock title="Zones" id="tblId">
          <apex:dataTable value="{!ZS}" var="r" cellPadding="4" border="1">
           <apex:column >
            <apex:facet name="header">Zone</apex:facet>
            <apex:outputText value="{!r}" />
            <!--<apex:inputText id="rZone" value="{!Zones_List__c.Rapid_Zone_Name__c}"/> -->
           <apex:column >
             <apex:facet name="header">Equipment</apex:facet>
              <apex:selectList size="1" id="equip" value="{!Zones_List__c.Equipment_Points__c}">
                <apex:selectOptions value="{!Equip}"/>
           <apex:column >
             <apex:facet name="header">Location</apex:facet>
              <apex:selectList size="1" id="location" value="{!Zones_List__c.Location__c}">
                <apex:selectOptions value="{!ZLoc}"/>



Best Answer chosen by Admin (Salesforce Developers) 

in your controller all you need is:


upsert zs;