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
Adam GilchristAdam Gilchrist 

rendered text input field value not getting saved(sometimes) on vf page

I have 4 comments field which rerender on the value of corresponding picklist value. The problem is the value of these 4 comment fields sometimes gets saved some times not. If i have given vaue in all 4 comments then randomly any of them showed blank after save.
I have added the code.
Any help?
VF Page

<apex:page standardController="FA_Attestation__c"  extensions="FAAttestation2">
   
    <apex:form >
        <font size = "3"> <b> <center>DaVita Hospital Services Arrangements Performance Monitoring Attestation </center> </b> </font> <br/>
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Save form" action="{!saveform}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection >
			<apex:pageBlockSectionItem >
                <apex:outputLabel value="1. Do you understand the scope of services required to be provided to this hospital under the HSA?" />
				<apex:actionRegion >
                    <apex:outputField value="{!FA_Attestation__c.best_of_your_knowledge_and_belief__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
                <apex:inputField value="{!FA_Attestation__c.best_of_your_knowledge_and_belief__c}" required="True" rendered="{!ISNULL(FA_Attestation__c.id)}" >
                    <apex:actionSupport event="onchange" reRender="comment1" />
                </apex:inputField>
                </apex:actionRegion>
				</apex:pageBlockSectionItem>
				<apex:outputPanel id="comment1">
				
                    <apex:pageBlockSection rendered="{!FA_Attestation__c.best_of_your_knowledge_and_belief__c=='No'}" >
                        <apex:outputField value="{!FA_Attestation__c.Enter_Comments_if_no_1__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
                        <apex:inputField value="{!FA_Attestation__c.Enter_Comments_if_no_1__c}"  label="If no then enter comments" rendered="{!ISNULL(FA_Attestation__c.id)}"></apex:inputField>
                    </apex:pageBlockSection>
                </apex:outputPanel>
                <!--question 2 begins here-->
				<apex:pageBlockSectionItem >
				<apex:outputLabel value="2. To the best of your knowledge and belief, are all services being performed for this hospital included in the HSA?" />
				<apex:actionRegion >
				<apex:outputField value="{!FA_Attestation__c.performed_for_this_hospital__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
                <apex:inputField value="{!FA_Attestation__c.performed_for_this_hospital__c}" required="True" rendered="{!ISNULL(FA_Attestation__c.id)}" >
                    <apex:actionSupport event="onchange" reRender="comment2"/>
                </apex:inputField>
				</apex:actionRegion>
				</apex:pageBlockSectionItem>
                <apex:outputPanel id="comment2">
                    <apex:pageBlockSection rendered="{!FA_Attestation__c.performed_for_this_hospital__c=='No'}">
						<apex:outputField value="{!FA_Attestation__c.If_no_enter_comments_2__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
                        <apex:inputField value="{!FA_Attestation__c.If_no_enter_comments_2__c}"   label="If no then enter comments" rendered="{!ISNULL(FA_Attestation__c.id)}"/>
                    </apex:pageBlockSection>
                </apex:outputPanel>
                
                <!--question 3 begins here--> 
				<apex:pageBlockSectionItem >
				<apex:outputLabel value="3. To the best of your knowledge and belief, have any services been performed for this hospital that are not included in the HSA?" />
				<apex:actionRegion >
				<apex:outputField value="{!FA_Attestation__c.provided_to_this_hospital__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
                <apex:inputField value="{!FA_Attestation__c.provided_to_this_hospital__c}" required="True" rendered="{!ISNULL(FA_Attestation__c.id)}" >
				
                    <apex:actionSupport event="onchange" reRender="comment3"/>
                </apex:inputField>
				</apex:actionRegion>
				</apex:pageBlockSectionItem>
                <apex:outputPanel id="comment3">
                    <apex:pageBlockSection rendered="{!FA_Attestation__c.provided_to_this_hospital__c=='No'}">
						<apex:outputField value="{!FA_Attestation__c.Enter_Comments_if_no_3__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
                        <apex:inputField value="{!FA_Attestation__c.Enter_Comments_if_no_3__c}"  label="If no then enter comments" rendered="{!ISNULL(FA_Attestation__c.id)}"></apex:inputField>
                    </apex:pageBlockSection>
                </apex:outputPanel>
                
                <!--question 4 begins here-->  
				<apex:pageBlockSectionItem >
				<apex:outputLabel value="4. To the best of your knowledge and belief, have all services that have been provided to this hospital been accurately billed for?" />
				<apex:actionRegion >
				<apex:outputField value="{!FA_Attestation__c.understand_the_scope_of_services__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
                <apex:inputField value="{!FA_Attestation__c.understand_the_scope_of_services__c}" required="True" rendered="{!ISNULL(FA_Attestation__c.id)}" >
                    <apex:actionSupport event="onchange" reRender="comment4"/>
                </apex:inputField>
				</apex:actionRegion>
				</apex:pageBlockSectionItem>				
                <apex:outputPanel id="comment4">
                    <apex:pageBlockSection rendered="{!FA_Attestation__c.understand_the_scope_of_services__c=='No'}"> 
					<apex:outputField value="{!FA_Attestation__c.Enter_Comments_if_no_4__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
                        <apex:inputField value="{!FA_Attestation__c.Enter_Comments_if_no_4__c}"   label="If no then enter comments" rendered="{!ISNULL(FA_Attestation__c.id)}"></apex:inputField>
                    </apex:pageBlockSection>
                </apex:outputPanel>
               
               <apex:inputField value="{!FA_Attestation__c.Confirmation__c  }" required="True" label="Are you sure you want to submit the form?" rendered="{!ISNULL(FA_Attestation__c.id)}"></apex:inputField>
			   <apex:outputField value="{!FA_Attestation__c.Confirmation__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
			   
                <apex:inputField value="{!FA_Attestation__c.Name_of_the_user__c }" required="True"  label="Please enter your name."  rendered="{!ISNULL(FA_Attestation__c.id)}"></apex:inputField>
				<apex:outputField value="{!FA_Attestation__c.Name_of_the_user__c}" rendered="{!NOT(ISNULL(FA_Attestation__c.id))}"/>
            
                </apex:pageBlockSection>
                
                
        </apex:pageBlock>
    </apex:form>
    
</apex:page>






--------------------Controller----------------------------

public class FAAttestation2 {
    ApexPages.StandardController std;
   
     public FAAttestation2(ApexPages.StandardController FAA2)
     {
       std= FAA2;
         
     }

 public pageReference saveform()
 {
     std.save();
     
     return null;
 }
}

 
Alain CabonAlain Cabon
Hello,

Is there a difference with the following constructor?
 
private final FA_Attestation__c std;
public FAAttestation2 (ApexPages.StandardController FAA2) {
         this.std = (FA_Attestation__c)FAA2.getRecord();
}

instead of
 
ApexPages.StandardController std;   
public FAAttestation2(ApexPages.StandardController FAA2)
{
    std= FAA2;      
}

Alain