I want to replace the save button with submit for approval in an edit page of record. So that every time a user tries to edit the record then it won't be saved right away rather it will be submitted for approval. Btw i am using standard salesforce page.
You can't replace the "Save" button like that. If you absolutely need something that automatically sends a record for approval, I recommend you write a trigger that manually does that on any save.
If you follow the sample in this link you will be able to see how it's done.
This snippet will prove particularly useful
// Create an approval request for the object Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setComments('Submitting request for approval.'); req1.setObjectId(*<Object ID>*); // Submit on behalf of a specific submitter req1.setSubmitterId(*<User Id>*); // Submit the record to specific process and skip the criteria evaluation req1.setProcessDefinitionNameOrId('*<ProcessName>*'); req1.setSkipEntryCriteria(true); // Submit the approval request for the object Approval.ProcessResult result = Approval.process(req1);