Created
September 6, 2014 13:43
-
-
Save tyoshikawa1106/653543e9d15cc0727ed7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardController="Account" showHeader="true" sidebar="false" id="page"> | |
<apex:include pageName="RemoteObjectsUpsertRemote" /> | |
<div id="vf-page"> | |
<apex:form id="form"> | |
<apex:inputText value="{!Account.Name}" id="accountName"/> | |
<apex:commandButton value="Upsert" onclick="return upsertAccount('{!Account.Id}', '{!$Component.accountName}');" /> | |
</apex:form> | |
</div> | |
<apex:include pageName="RemoteObjectsUpsertScript" /> | |
</apex:page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page > | |
<apex:remoteObjects > | |
<apex:remoteObjectModel name="Account" fields="Id" /> | |
</apex:remoteObjects> | |
</apex:page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page > | |
<script type="text/javascript"> | |
function upsertAccount(prmAccountId, prmAccontName) { | |
var accountName = document.getElementById(prmAccontName).value; | |
var account = new SObjectModel.Account(); | |
if (prmAccountId) { | |
account.set('Id', prmAccountId); | |
} | |
account.set('Name', accountName); | |
account.upsert(function(err, results, event) { | |
if (err) { | |
alert(err.message); | |
} else { | |
console.log(results); | |
} | |
}); | |
return false; | |
} | |
</script> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment