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

Please post me a simple example...

Hi everybody,


could you post me a simple example (code snipped) please, how to create a visualforce page with an input-field (text) and a "submit"-button.

After inserting text in the textbox and click on the submit button, the text should call a apex-class (java) and simlpy append the string "_abc" to the text.

The new text should appear on the visualforce page under the submit button.


Thanks for every post.






Here you go...


VF page 

<apex:page Controller="sampleClass" >
    <apex:form >
         <apex:sectionHeader title="Edit"></apex:sectionHeader>
          <apex:pageBlock title="Project Information" mode="edit" id="thePageBlock">
                 <apex:pageBlockButtons >
                    <apex:commandButton action="{!process}" value="submit" />
                <apex:inputText id="textbox1" value="{!Text}" />
                <apex:outputLabel value="{!EnteredLabelText}" />



Apex Class


 public class sampleClass {
    String enteredText = '';
    String enteredLabelText = '';
    public pagereference Process()
        enteredLabelText = enteredText + '_abc' ;
        return null;            
    public  void setText(String s)
    { enteredText = s; }
    public  string getText()
    { return enteredText; }
    public void setEnteredLabelText(String ss)
    { enteredLabelText = ss;    }
    public String getEnteredLabelText()
    { return enteredLabelText ;}