You need to sign in to do that
Don't have an account?

Rerender Visualpage after Remote Action
Hi guys,
I need some help in Renendering my VF to a particular Pageblock (or bottom of the page) after using @Remote Action.
Can you please help ?
This is my Controller:
public without sharing class RController1 {
@RemoteAction
Public static boolean saveSign(String signatureBody, id sobjId){
try{
Attachment sign = new Attachment();
sign.parentId = sobjId;
sign.Body = EncodingUtil.base64Decode(signatureBody);
sign.ContentType = 'image/png';
sign.Name = 'Signature Capture.png';
insert sign;
}catch(Exception e){
return false;
return null;
}
}
My Visualforce Page:
<apex:page standardController="Registration__c" extensions="RController1">
function saveSign(){
var strDataURI = canvas.toDataURL();
console.log(strDataURI);
strDataURI = strDataURI.replace(/^data:image\/(png|jpg);base64,/, "");
console.log(strDataURI);
RegistrationController1.saveSign(strDataURI,parentId,
function(result,event){
if (event.status){
rerendAction(); }
else{ console.log(event.message); ) } }, {escape:true} );
}
<apex:actionFunction name="rerendAction" rerender="sign"/>
<apex:pageBlockSection title="Signature" id="sign">
<c:Signature parentId="{!$CurrentPage.parameters.Id}"/>
<br />
<apex:pageBlockSectionItem >
<apex:commandButton onclick="javascript:clearArea();return false;" onkeypress="" value="Clear Signature" style="width:60%" /> <apex:commandbutton id="sign" onclick="saveSign()" value="Submit Signature" style="width:60%" />
</apex:pageBlockSectionItem> <br />
</apex:pageBlockSection>
Thanks,
Raghu
May I suggest you please refer the below link to reference.
- https://developer.salesforce.com/forums/?id=906F0000000BF1hIAG
Hope it helps.Please mark it as best answer if the information is informative.
Thanks
Rahul Kumar
Have tried that link, but its not working.
After the javascript Remoting the page reloads. I want the focus back to the block where the button was cllicked. ?
Thanks,
Raghu