+ Start a Discussion
Rajasekhar TRajasekhar T 

Save button is not working when data dynamically updated from page input field?

I have created visual force page for updating records from the page. in my code Owner__c is Parent, Vehicle__c is Child. once i enter value owner object discount__c field , i need to update same value in Vehicle object Disc__c filed.  save button is not working and not updating my data in dynamically. Why this happening? How can I resolve this issue. Please can any one help me out. Please find the below my code.
<div class="slds-col slds-size_6-of-12">
                            <label class="slds-form-element__label"> Discount:
                           <b><label class="slds-form-element__label"><apex:inputfield value="{!Owner__c.Discount__c}"/></label></b> 


      <apex:commandButton styleClass="slds-button slds-button_brand" status="status"
                                                        reRender="none" value="Save" id="saveButton"/>


public with sharing class OwnervehicleController {

  public List<Vehicle__c> Retest{ get; set; }
    public Owner__c Offer {get;set;}
    public String OwnrId { get; set; }

     public OwnervehicleController(ApexPages.StandardController sc) {

        OwnrId = sc.getId();

        Retest = [
                SELECT Id,Name,Owner__c,Disc__c FROM Vehicle__c
                WHERE Owner__c = :OwnrId ];
        Offer = [SELECT id,Discount__c FROM Owner__c 
                 WHERE id = : OwnrId];

    public PageReference Save(){   
   Update offer;

    Owner__c sc=[select id,Discount__c from Owner__c where id=:OwnrId];    
    list<Vehicle__c> Vcle=[select id,Disc__c,Owner__c From Vehicle__c where 

    for(Vehicle__c oitem:Vcle)
    oitem.Disc__c =sc.Discount__c;   

   update sc; 
     update Vcle;

        Update Retest; 
        PageReference pg = new PageReference('/'+OwnrId);

        return Null;