You need to sign in to do that
Don't have an account?
juppinger
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.
joerg
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:pageBlockButtons>
<apex:inputText id="textbox1" value="{!Text}" />
<apex:outputLabel value="{!EnteredLabelText}" />
</apex:pageBlock>
</apex:form>
</apex:page>
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 ;}
}