[SalesForce] Used html button instead of apex command button,controller action not updating new values?why

Used html button instead of apex command button, but only old values are passing to contrller action method why? Its working fine for commandbutton!!

    <apex:actionFunction name="initiateactionmethod" reRender="basicid" action="{!updatedetails}" status="AjaxLoader" oncomplete="window.location.reload( true );">

        </apex:actionFunction> 

 <input type="button" class="button-a blue"  onclick="initiateMethod();"  value="save"/>

previous command button::

<apex:commandButton value="Save"   styleClass="button-a blue"  action="{!updatedetails}" />

Best Answer

Values from your page are sent to a controller on form submit. You can see this if you view HTML code generated by your visualforce page <apex:commandButton/> will be an input with type="submit".

So try changing the type of your button:

 <input type="submit" class="button-a blue"  onclick="initiateMethod();"  value="save"/>
Related Topic