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
Naresh Krishna.ax1176Naresh Krishna.ax1176 

How to get the visualforce page component value in controller ?

Hi All,

 

By using dynamicComponent concept am able to create visualforce component (inputText).

But how to get the entered text value when I click on commandButton 'test' ?

 

Please see the code below:

Page:

<apex:page controller="SimpleDynamicController" sidebar="false" >
<apex:form >
<apex:dynamicComponent componentValue="{!sampleInputTxt}" /> 

<apex:commandButton action="{!testSampleInputTxt}" value="test"/>

</apex:form>
</apex:page>

 

Controller:

public class SimpleDynamicController {


public Component.Apex.inputText getSampleInputTxt() {
Component.Apex.inputText inText = new Component.Apex.inputText();
inText.id = 'TextId';
return inText;
}


public PageReference testSampleInputTxt() {

 

//Print the inputText value entered

return null;
}

}

 

Could anyone please help me on this.

 

Thanks.