function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KiloJKiloJ 

VF InputField Not Binding

Hi There. I have a simple controller and VF page.

Here's my controller:

 

 

public class RepPlanningController { public String selectedSegmentation { get; set; } public String selectedStatus { get; set; } public String selectedRating { get; set; } public String selectedFilterLetter { get; set; } public Id idOfEventAccount { get; set; } public List<AccEventRecord> recordDataList { get; set; } private Map<Id,Event> cachedAccEventsMap { get; set; } public class AccEventRecord { public Account acc { get; set; } public Event ev { get; set; } //Each event field in each record in the VF pageBlockTable bind to this property. public AccEventRecord(Account acc) { this.acc = acc; this.ev = new Event(); } } public void queryForAccounts() { recordDataList = new List<AccEventRecord>(); cachedAccEventsMap = new Map<Id,Event>(); for(Account a : [Select Name, Id, Activity_Rating__c, Visit_Threshold_Rating__c From Account ORDER BY Name ASC]) recordDataList.add(new AccEventRecord(a)); } public PageReference saveSingleEvent() { if(idOfEventAccount != null) { for(AccEventRecord aer : recordDataList) { if(aer.acc.Id == idOfEventAccount) { System.debug('***** ACCOUNT TO ADD EVENT TO IS: ' + aer.acc.Name + ' : ' + aer.ev.ActivityDate + ' : ' + aer.ev.Subject + ' : ' + aer.ev.Type); break; } } } return null; } }

 and here's my VF page:

 

 

<apex:page controller="RepPlanningController" action="{!queryForAccounts}" tabStyle="Account" id="VFPage"> <apex:sectionHeader title="Cuenta" subtitle="Planificación" /> <apex:form style="padding-top:15px;"> <apex:pageBlock title="Todas Cuentas" id="accountTable"> <apex:pageBlockTable value="{!recordDataList}" var="accountRec" style="width:100%;"> <apex:column > <apex:facet name="header">Account Name</apex:facet> <apex:commandLink value="{!accountRec.acc.Name}" /> </apex:column> <apex:column > <apex:facet name="header">Event Date</apex:facet> <apex:inputField value="{!accountRec.ev.ActivityDate}" /> </apex:column> <apex:column > <apex:facet name="header">Event Subject</apex:facet> <apex:inputField value="{!accountRec.ev.Subject}" /> </apex:column> <apex:column > <apex:facet name="header">Event Type</apex:facet> <apex:inputField value="{!accountRec.ev.Type}" /> </apex:column> <apex:column style="padding-top:8px;"> <apex:commandLink action="{!saveSingleEvent}" value="Guardar" immediate="true" styleClass="btn" style="color:#FFF; padding:2px 5px 2px 5px; text-decoration:none;"> <apex:param value="{!accountRec.acc.Id}" assignTo="{!idOfEventAccount}" name="{!accountRec.acc.Id}" /> </apex:commandLink> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 Unfortunately the system.debug in my controller method saveSingleEvent
 
always shows the Event fields as null for some reason even though there are inputFields binding

to the Event SObject in the class AccEventRecord. Has anyone got any ideas?
This is urgent!

 

many thanks

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
JPClarkJPClark

It took me some time when I ran into this also. According to the documentation, immediate=true will bypass the the validation rules.

 

A Boolean value that specifies whether the action associated with this component should happen immediately, without processing any validation rules associated with the fields on the page. If set to true, the action happens immediately and validation rules are skipped. If not specified, this value defaults to false. 

 

But in my experience, it also bypasses sending any data back to the controller properties.

All Answers

JPClarkJPClark
Try removing the immediate="true" on the command link. It will ignore values on the page.
KiloJKiloJ

Hi there. You were right, it works.

Thank you very much for the help as I had spent a long time trying to get this to work.
Can tell my why this works when immediate=true is removed?
Thanks again 

Message Edited by KiloJ on 08-21-2009 07:48 AM
JPClarkJPClark

It took me some time when I ran into this also. According to the documentation, immediate=true will bypass the the validation rules.

 

A Boolean value that specifies whether the action associated with this component should happen immediately, without processing any validation rules associated with the fields on the page. If set to true, the action happens immediately and validation rules are skipped. If not specified, this value defaults to false. 

 

But in my experience, it also bypasses sending any data back to the controller properties.

This was selected as the best answer
KiloJKiloJ

You're spot on. I wish the documentation said this. It would have saved me 2 days banging my head off the table!

 

Many thanks to you again.

Kind regards