You need to sign in to do that
Don't have an account?

Valuse form ApexPage to Controller
Hi ,
I would like to get the values form ApexPage to the Controller,
So, could Anyone pls help me with the Sample code how could
i achieve this.
Thank you
You need to sign in to do that
Don't have an account?
Hi ,
I would like to get the values form ApexPage to the Controller,
So, could Anyone pls help me with the Sample code how could
i achieve this.
Thank you
Hi,
You have to simply create a property of that field inside the controller and you will get that value inside the controller.
Try the below code as reference:
<apex:page controller=’test’>
<apex:form>
<apex:inputtext value={!firstval}/>
</apex:form>
</apex:page>
/////////////////// Controller ///////////////////////
Public class test
{
Public string firstval{get;set;}
Public test()
{
System.debug(‘@@@@@@@@@@@@@@’ + firstval);// You will get the value as you have enter on your VF page.
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
HI ,
Actually what iam looking for is , i have a datepicker and if i select a date,
and try to print the date in the same page, how would i achieve this..
ThankYou
Hi,
try the below code
----------- Vf page--------------
<apex:page controller="adddaysindate" >
<script>
function adddays(fieldval)
{
var chkval=fieldval.value;
calladddays(chkval);
}
</script>
<apex:form >
<apex:actionFunction name="calladddays" reRender="pp" action="{!adddaysindate}"> <apex:param name="assignvalue" value="" assignTo="{!getdate}"/></apex:actionFunction>
<apex:inputField value="{!con.Birthdate}" onchange="adddays(this)"/>
<Apex:outputPanel id="pp" >
<apex:outputText value="{!printdate}" ></apex:outputText>
</Apex:outputPanel>
</apex:form>
</apex:page>
-------- Apex Controller--------------
public class adddaysindate
{
public contact con{get;set;}
public string getdate{get;set;}
public date chk{get;set;}
public string printdate{get;set;}
public adddaysindate()
{
con=new contact();
}
public void adddaysindate()
{
date t=date.parse(getdate);
printdate=t.format();
}
}