+ Start a Discussion
karthik Jonnalagaddakarthik Jonnalagadda 

Submit form from Visual Force Page to Controller

Hello All,

I am trying to display contacts in the vsf page.as follows and now I have to submit the stage and Closed Date values to different object. Please let me know how can I achive this. 
VSF Page 
Best Answer chosen by karthik Jonnalagadda
William TranWilliam Tran
In your "Add to Cart"  method, assign the value of stage and closed date to the different object.

for example:

DifferentObject__c obj= new DifferentObject__c();

obj.stage__c = contact.Stage__c;
obj.closeddate__c = contact.closedate__c;

insert obj;

.........

where contact.Stage__c and contact.closedate__c are variables you bind to the VF page.

if it is a list then you need to work with a list : LIst<DIfferentObject__c> objs = new LIst<DIfferentObject__c>();........

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you. 

Thanks

All Answers

Rahul GoyalRahul Goyal
Use selectoption to get the selected value of the stage in the contoller and then I think you can save that value in other object from Controller...
William TranWilliam Tran
In your "Add to Cart"  method, assign the value of stage and closed date to the different object.

for example:

DifferentObject__c obj= new DifferentObject__c();

obj.stage__c = contact.Stage__c;
obj.closeddate__c = contact.closedate__c;

insert obj;

.........

where contact.Stage__c and contact.closedate__c are variables you bind to the VF page.

if it is a list then you need to work with a list : LIst<DIfferentObject__c> objs = new LIst<DIfferentObject__c>();........

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you. 

Thanks
This was selected as the best answer