For exmaple you have a form with below fields:-
<apex:form>
<input type="text" name="firstname"/>
<input type="text" name="lastname"/>
<apex:commandbutton value="SubmitMe" action="{!saveform}"/>
</apex:form>
Your apex class's saveform method:-
public PageReference saveform(){
string firstName = ApexPages.currentPage().getParameters().get('firstname');
string lastName = ApexPages.currentPage().getParameters().get('lastname');
//So simple
//Do your stuff
return null
}
Enjoy!!!
How to retrieve form values in traditional way on VF without binding
Thursday, September 24, 2009
by Aslam - The Alexendra
Posted in |
6 Comments »
Subscribe to:
Post Comments (Atom)
6 comments:
That's awesome! I had no idea that worked.
Thx for it:) I want to set current page's query string variable .. is there any set method like get method.. for controller's action ?
@Naresh: Yes, you can use...
ApexPages.currentPage().getParameters().put('name','testing');
You told me earlier too about this nice trick , It really helps.
Thanks
This is very easy trick for retrieving the form elements. Very Useful Post!
Thanks bayya!
wow great aslam.....thinking in new way.....
Post a Comment