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
BrianWKBrianWK 

<apex:inputText> element value must resolve to a String type!

Hey Everyone,

 

I've got this issue and I'm stumped.

 

I have a Visualforce page with an HTML table. One of the cells has a number of components, Outputtext, inputtext, and 3 command links that are rendered based on some boolean values I have. For the most part things work, but I've run in an issue.

 

 

<apex:inputText> element value must resolve to a String type!

This is perplexing since the input text isn't rendered, and the the value that it would've been rendered if present should be valid (considering I just entered it, it's saved as a Integer, but that shouldn't cause an issue).

 

I'm simply stumped! Anyone see this? If I comment out the inputtext it works fine -- but I need an input text field to allow user entry.

Table of the VF page:

 

<apex:page controller="Imp_Forecast_Controller" tabStyle="Imp_Forecast__c" > <apex:form id="MyForm"> <apex:pageblock title="My Forecast" id="MyForecastBlock"> <apex:pageblocksection title="{!PeriodDate1a} bOverride1: {!bOverride1} OverRideSave1: {!OverRideSave1}" id="PeriodSection1" columns="1"> <apex:outputpanel id="FieldOutput1" > <Table cellpadding="15px" width="100%"> <tr> <td style="font-weight:bold;">Implementer</td> <td style="font-weight:bold;">Commit</td> <td style="font-weight:bold;">Actual Live</td> <td style="font-weight:bold;">Projected</td> <td style="font-weight:bold;">Comment</td> </tr> <tr> <td>{!ThisUser.Name}</td> <td> <apex:outputtext value="{!Period1Imps}" rendered="{!bOverRide1 == false}" /> <apex:outputtext value="{!Override1}" rendered="{!OverRideSave1 == true && bOverride1 == true}" style="color:red;font-weight:bold;"/> <apex:inputtext value="{!Override1}" rendered="false" /> <!-- rendered="{!bOverRide1 == true && OverrideSave1 == false}" /> --> &nbsp; <apex:commandlink value="Save" action="{!ParseActions}" ReRender="MyForecastBlock, Forecast" rendered="{!OverRideSave1 ==false && bOverRide1 == true}"> <apex:param name="PeriodID" value="1"/> <apex:param name="Action" value="Save" /> </apex:commandlink> &nbsp; <apex:commandlink value="Cancel Override" action="{!ParseActions}" ReRender="MyForecastBlock, Forecast" rendered="{!bOverRide1 == true}" > <apex:param name="PeriodID" value="1"/> <apex:param name="Action" value="Cancel" /> </apex:commandlink> &nbsp; <apex:commandlink value="Override" action="{!ParseActions}" ReRender="MyForecastBlock, Forecast" rendered="{!bOverride1 == false}" > <!-- > || OverRideSave1 == true}"> --> <apex:param name="PeriodID" value="1"/> <apex:param name="Action" value="OverRide" /> </apex:commandlink> </td> <td>{!Period1LiveImps}</td> <td>{!Period1ProjectedImps}</td> </tr> </Table> </apex:outputpanel> </apex:pageblocksection> </apex:pageblock> </apex:form> </apex:page>

 

Controller method (which gets called from all the other command links properly but not my cancel button)

 

public PageReference ParseActions() { system.debug('Start ParseActions!!'); string PeriodID = getParam('PeriodID'); string Action = getParam('Action'); system.debug('THIS IS THE PERIODID: ' + PeriodID); system.debug('THIS IS THE ACTION: ' + Action); if(Action == 'Save') { if(PeriodID =='1'){OverRideSave1=true;Period1 = OverRide1;} if(PeriodID =='2'){OverRideSave2=true;Period2 = OverRide2;} if(PeriodID =='3'){OverRideSave3=true;Period3 = OverRide3;} } if(Action == 'OverRide') { OverRide1 = 2; if(PeriodID =='1'){bOverRide1 = true;} if(PeriodID =='2'){bOverRide2 = true;} if(PeriodID =='3'){bOverRide3 = true;} } if(Action == 'Cancel') { if(PeriodID =='1'){bOverRide1= false; OverRideSave1 = False;Period1 = Period1Imps;OverRide1 =0;} if(PeriodID =='2'){bOverRide2= false; OverRideSave2 = False;Period2 = Period2Imps;OverRide2 =0;} if(PeriodID =='3'){bOverRide3= false; OverRideSave3 = False;Period3 = Period3Imps;OverRide3 =0;} } system.debug('VALUES!!!'); system.debug('Priod1Imps: ' + Period1Imps); system.debug('Priod2Imps: ' + Period2Imps); system.debug('Priod3Imps: ' + Period3Imps); system.debug('Period1: ' + Period1); system.debug('Period2: ' + Period2); system.debug('Period3: ' + Period3); system.debug('OverRide1: ' + OverRide1); system.debug('OverRide2: ' + OverRide2); system.debug('OverRide3: ' + OverRide3); system.debug('BOOLEANS!!!'); system.debug('bOverRide1: ' + bOverRide1); system.debug('bOverRide2: ' + bOverRide2); system.debug('bOverRide3: ' + bOverRide3); system.debug('OverRideSave1: ' + OverRideSave1); system.debug('OverRideSave2: ' + OverRideSave2); system.debug('OverRideSave3: ' + OverRideSave3); return null; }

 

 

 

Nick1746323Nick1746323
is "Override1" the Integer that you mentioned? I think try a String
BrianWKBrianWK

Actually, it has nothing to do with data type.

 

I put an outputpanel around the apex input and now it works without an issue. I don't know WHY i need to have an output panel on just the input field - but that one changed fixed it

CustomForceCustomForce

Just to be clear, move the rendered (or disabled) attribute to the enclosing outputPanel component and the problem goes away.

RupaliJRupaliJ

Hi,

 

I am facing the same issue. I used outputpanel, but unfortunately its not working. Can you please post your piece of code?

 

Thanks.

Mitesh SuraMitesh Sura
Chances are Salesforce is not going to fix this. Here is the workaround..
 
//Make fields read only based on profile
            $('.readOnly').each(function(i){               
                element = $(document.getElementById(this.id)); 
                element.attr('readOnly', true); 
                element.css({'background-color' : '#DFD8D1'});
                element.attr('title','Insufficient Privileges');
            });