You need to sign in to do that
Don't have an account?
Abhilash Mishra 13
How to get Form data from visual force page as an instance of inner class
Hi I want to get all the fields data as and instace to inner class. is it possible?
I have written this code here
VF page
Here is the controller :
above code doesnt seems to be working.
Can someone point out the issue? need Help
Regards
Abhilash Mishra
I have written this code here
VF page
<apex:page controller="mycontroller"> <apex:form> <apex:pageblock> <apex:pageblocksection> <apex:pageblocksectionitem> <apex:outputlabel for="fname"> First Name</apex:outputlabel> <apex:inputtext value="{!info.firstname}" id="fname"/> </apex:pageblocksectionitem> <apex:pageblocksectionitem> <apex:outputlabel for="lname">Last Name</apex:outputlabel> <apex:inputftext value="{!info.lastname}" id="lname"/> <apex:pageblocksectionitem> </apex:pageblocksection> <apex:commandbutton action="{!savedata}" value="submit"/> </apex:pageblock> </apex:form> </apex:page>
Here is the controller :
public with sharing class mycontoller{ public info { get{ if(info==null) return new information(); return info; } set; } public information { public firstname {get;set;} public lastname {get;set;} } }
above code doesnt seems to be working.
Can someone point out the issue? need Help
Regards
Abhilash Mishra
Did It By modifying apex class to :
simple custom getter and setter methods:
All Answers
Visualforce
Controller:
If you are happy with this answer, please mark.
Thanks !!!!
But this is not what I want to do? My objective is to minimize the variale declaration?
I actually have 4 field 2 for buyers name and 2 for sellers. and I was kind of hoping by using inner class I might be able to get them by reference of the innerclass.
like this.
I want to achieve this declaring Firstname and last name only once as an innerclass and user that class as a wrapper.
Regards
Abhilash Mishra
Did It By modifying apex class to :
simple custom getter and setter methods: