+ Start a Discussion
zaidyzaidy 

No able to get input from a Custom Component

Hi, 

 

During the save method on the page, I am not able to get any input from my components. 

 

1. Here is my page, which uses the standard controller of  custom object called managerFeedback__c: 

<apex:page standardController="managerFeedback__c" showHeader="false">    
    	<apex:define name="heading">
            Emp Appraisal Form
        </apex:define>
        <apex:define name="content">
        	<apex:outputText value="{!managerFeedback__c.id}"></apex:outputText>
 			<apex:outputPanel >  			     
			 	<c:FContainer managerFeedInput="{!managerFeedback__c.Input__c}">			     		
			 	</c:FContainer>
			</apex:outputPanel>
			
			<apex:form >
	    		<apex:pageBlock >
					<apex:pageBlockButtons style="float:right;margin-right:20px;" location="bottom">                      
	                      <apex:commandButton action="{!save}" value="Save"/>
	                </apex:pageBlockButtons>    		
	    		</apex:pageBlock>
	    	</apex:form>
      </apex:define>    
</apex:page>

 2. Here is my component FContainer:

 

 

<apex:component >
<apex:attribute name="managerFeedInput" description="managerFeedInput" type="String" />
	<apex:form >
				<apex:outputPanel >
			    		
			    		<apex:inputText value="{!managerFeedInput}" style="display:block; width:99%"/>
	    		</apex:outputPanel>
	</apex:form>
</apex:component>

3. When displaying the page like the following screen shoot , I click the Save button and input text "This text can't be saved back to the managerFeedback record" is not saved back to the record's Input__c field, although I can see that it updates the record's LastModifiedDate field. 

 

Page and FComponent

 

I have tried to retrieved the Input__c value from the component by using custom controllers as well and I am not able to do so either. 

 

Any ideas?

 

Thanks in advanced, 

Zaidy

 

 

WesNolte__cWesNolte__c

Hi Zaidy, we here :)

 

Your commandbutton must be inside the form tags of the component, not inside it's own form.

 

<apex:page standardController="managerFeedback__c" showHeader="false">    
    	<apex:define name="heading">
            Emp Appraisal Form
        </apex:define>
        <apex:define name="content">
        	<apex:outputText value="{!managerFeedback__c.id}"></apex:outputText>
 			<apex:form><apex:outputPanel >  			     
			 	<c:FContainer managerFeedInput="{!managerFeedback__c.Input__c}">			     		
			 	</c:FContainer>
			</apex:outputPanel>
			
			
	    		<apex:pageBlock >
					<apex:pageBlockButtons style="float:right;margin-right:20px;" location="bottom">                      
	                      <apex:commandButton action="{!save}" value="Save"/>
	                </apex:pageBlockButtons>    		
	    		</apex:pageBlock>
	    	</apex:form>
      </apex:define>    
</apex:page>

and in your component

<apex:component >
<apex:attribute name="managerFeedInput" description="managerFeedInput" type="String" />
	<apex:form >
				<apex:outputPanel >
			    		
			    		<apex:inputText value="{!managerFeedInput}" style="display:block; width:99%"/>
	    		</apex:outputPanel>
	</apex:form>
</apex:component>