Created
September 6, 2014 13:19
-
-
Save tyoshikawa1106/c4543116e7e7c89f35cc to your computer and use it in GitHub Desktop.
RemoteObjects Update
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="RemoteObjectsUpdateRemote" /> | |
<div id="vf-page"> | |
<apex:form id="form"> | |
<apex:inputText value="{!Account.Name}" id="accountName"/> | |
<apex:commandButton value="Update" onclick="return updateAccount('{!Account.Id}', '{!$Component.accountName}');" /> | |
</apex:form> | |
</div> | |
<apex:include pageName="RemoteObjectsUpdateScript" /> | |
</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 updateAccount(prmAccountId, prmAccontName) { | |
var accountName = document.getElementById(prmAccontName).value; | |
var account = new SObjectModel.Account(); | |
account.set('Id', prmAccountId); | |
account.set('Name', accountName); | |
account.update(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