You need to sign in to do that
Don't have an account?
MickJ
dataTable object binding update
I have a list of a custom object that I display on a VisualForce page using a dataTable. The dataTable has four columns. The first is outputText, the second and third inputText, and the fourth inputCheckbox. The user modifies the contents of the inputText and inputCheckbox and then saves (updates). Initially everything works as expected. However after a few successful saves I always get the following error message:
<apex:inputText> element value must resolve to a String type!
If I log out, close the browser, and then return to the page I still get the error. I've read a few articles related to this type of functionality and my code seems to be using the correct approach.
Any thoughts on this?
Here is the code:
<apex:inputText> element value must resolve to a String type!
If I log out, close the browser, and then return to the page I still get the error. I've read a few articles related to this type of functionality and my code seems to be using the correct approach.
Any thoughts on this?
Here is the code:
Code:
public class UpdateContractUsageStats { private final List<Contract_Usage_Data__c> ContractUsageData; public UpdateContractUsageStats() { ContractUsageData = [Select Id, Usage_Report_Interval_Label__c, Usage_Report_Date__c, UsageLives__c, UsageAmount__c, Usage_Report_Certified__c From Contract_Usage_Data__c Where Contract__c=: ApexPages.currentPage().getParameters().get('cid')]; } public PageReference save() { try{ update ContractUsageData; } catch(DmlException ex){ ApexPages.addMessages(ex); } return null; } public List<Contract_Usage_Data__c> getContractUsageData(){ return ContractUsageData; } }
Code:
<apex:page controller="UpdateContractUsageStats"> <apex:messages /> <apex:form > <apex:dataTable value="{!ContractUsageData}" var="intervalData" id="theTable" rowClasses="odd,even" styleClass="tableClass"> <apex:column width="25%"> <apex:facet name="header">Interval</apex:facet> <apex:outputText value="{!intervalData.Usage_Report_Interval_Label__c}"/> </apex:column> <apex:column > <apex:facet name="header">Usage Lives</apex:facet> <apex:inputText value="{!intervalData.UsageLives__c}" disabled="{!intervalData.Usage_Report_Certified__c}"/> </apex:column> <apex:column > <apex:facet name="header">Usage Amount</apex:facet> <apex:inputText value="{!intervalData.UsageAmount__c}" disabled="{!intervalData.Usage_Report_Certified__c}"/> </apex:column> <apex:column > <apex:facet name="header">Certified</apex:facet> <apex:inputCheckbox value="{!intervalData.Usage_Report_Certified__c}" disabled="{!intervalData.Usage_Report_Certified__c}"/> </apex:column> </apex:dataTable> <apex:commandButton value="Update Statistics" id="theButton" action="{!save}"/> </apex:form> </apex:page>
Please make a different getter and setter for this text box and return the amount in string type variable ,I mean return type should be string.
Thanks
Mrutyunjay
Mrutyunjay - I tried you suggestion with no luck. Thanks for the suggestion.
I think we'll work around the issue by populating a listbox with the values from the first column and use a single set of inputs to capture user input.
If you enable all your fields on the form, it works fine. Did you found any workaround on this?
GreatG
Ran into the same problem. It's appears to be narrower than GreatG says though. Ordinarily you can bind a numeric field to an inputText element, but if an inputText element is bound to a numeric field and disabled then the error is displayed on submitting.
I can proabably knock up a minimal page with the error if required.
Seems to be a bug in sales force. You can wrap the input text with output panel.
I found a work arround here :
http://omgili.com/jmp/0xd.sZhj5je.krt0vaog6xfXRlNmsnwoY3jAfyn.1xs7hJ60fZnlBcMWY1iGXmMjzkx10B19YYL.YcLLBLeaSW1HTBjqVm5j.LGOL4sFnHpSmYa0qWP9e3HBg2OOiXO.l9h1ziWt_0hpUFWxiEecXfLAAV7cwf.jzmqO.rCbvBAsOxmuDdEyHlmSordP5ezxGB_OAJjPBCTC.TzUXMP5RV1qs2jWQ3r8fzDi0BZYyJ6BLaH1s5G7HrZWf_TsLbCbmqJp1.CNxqH6ew8g9zzEbvNyose77tijKhJkuid044s9LptZJnl8bjJl0ni39kUJ
wow! the forum dates to 2008 and it is still not resolved in 2012 !!!