+ Start a Discussion
Michal Bajdek 34Michal Bajdek 34 

Update field without submit button on Layout

Hello guys, I encounter a problem with updating field value without submit button. Due to buisness requirements I have to add visualforcepage onto CustomObject layout for one of its recordtypes. Page has checkbox which must be updated directly from page (I know that I can put this field on the layout, but visibility logic is quite complicated so it is way easier to drive visibility from ApexLevel). The problem is I can not add  submit buton, and it has to be updated on change.
User-added image
This is my page & controller:
public class RemoteObjectExtension {
    public ApexPages.Standardcontroller standardController;
    public RemoteObject__c contextObject {get;set;}
    public boolean valueOfCheckbox {get;set;}
    public RemoteObjectExtension( ApexPages.StandardController controller ){
        this.standardController = controller;
        this.contextObject = (RemoteObject__c)standardController.getRecord();
    public void updateRemoteObject(){
        system.debug( logginglevel.info , ' Value from VFP: ' + this.valueOfCheckbox );

<apex:page standardController="RemoteObject__c" extensions="RemoteObjectExtension">
    <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <div id="wrapper">
                    <apex:outputLabel value="{!$ObjectType.RemoteObject__c.fields.Faulty__c.Label}"/>
                    <apex:inputField id="faultyChbx" value="{!RemoteObject__c.Faulty__c}" onChange="updateRemoteObject()"/>
                    <apex:actionFunction action="{!updateRemoteObject}" reRender="wrapper" name="updateRemoteObject">
                        <apex:param name="valueOfCheckbox" assignTo="{!valueOfCheckbox}" value="{!RemoteObject__c.Faulty__c}"></apex:param>

but problem is I can not see changes in debug logs. I know that it might be caused by a fact that I am taking value from CustomObject, and I've tried approach with document.getelementbyid('ID').value but it also does not work. Any ideas? 
Zhen Yueh LeanZhen Yueh Lean
Hi Michal, your problem could be related to this: https://salesforce.stackexchange.com/questions/169808/actionfunction-rerender-not-working-in-my-vf-page/193387