You need to sign in to do that
Don't have an account?
Ashu sharma 38
how to show date field in vf page
Hello!!!!!!!
in the beow code i am displaying date but i want to dispaly as per the standard look as salesfroce date displaying.
<apex:page controller="UserRegistrationForm" docType="html-5.0">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!SaveUserRegistrationForm}" value="Sumbit"/>
<apex:commandButton action="{!cancelMe}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
Name:<apex:inputText value="{!name}"/>
LastName:<apex:inputText value="{!lastName}"/>
User Name:<apex:inputText value="{!userName}"/>
Password:<apex:inputSecret value="{!password}"/>
Date:<apex:input type="date" value="{!dateOfBirth}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
in the beow code i am displaying date but i want to dispaly as per the standard look as salesfroce date displaying.
<apex:page controller="UserRegistrationForm" docType="html-5.0">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!SaveUserRegistrationForm}" value="Sumbit"/>
<apex:commandButton action="{!cancelMe}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
Name:<apex:inputText value="{!name}"/>
LastName:<apex:inputText value="{!lastName}"/>
User Name:<apex:inputText value="{!userName}"/>
Password:<apex:inputSecret value="{!password}"/>
Date:<apex:input type="date" value="{!dateOfBirth}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
You can try using <apex:inputField value="{!dateOfBirth}"
Best Regards,
Sandhya
Use apex:InputText in your Visualforce Page.
Then please change the date formatt in controller
Thanks
Thank you for you answer but its not working,i ma geetibng an error on this....
"Could not resolve the entity from <apex:inputField> value binding '{!dateOfBirth}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable."
thank you for your answer,
i have an doubt....should i change the filed datatype of "date"?? bcoz i have declared date as datatype.
when i am using you code code getting error....
Can you please share the error.
I am taking the date type datatype for Date....
and you mention that take string type...
Use dayString instead of dateOfBirth in your visualforce code.
Also make it apex:InputText.
Illegal assignment from Date to String
error is coming......
I am done but not come same as standard date field format....
its seems like as same as HTMl format which come earlire...no change.....
Make sure you are using apex:InputText instead of apex:input.
Date:<apex:InputText value="{!dayString}"/>
Below code....
Date: <apex:panelGroup styleClass="col02 requiredInput" layout="block">
<apex:panelGroup styleClass="requiredBlock" layout="block"></apex:panelGroup>
<apex:inputText value="{!dayString}"/>
</apex:panelGroup>
is it????
public class UserRegistrationForm {
public string name {set;get;}
public string lastName {set;get;}
public string userName {set;get;}
public string password {set;get;}
public date dayString {set;get;}
public integer count ;
public list<user2__c> UBS;
public void SaveUserRegistrationForm(){
user2__c UC=new user2__c();
UBS=new list<user2__c>();
UC.name=name;
UC.last_Name__c=lastName;
UC.user_name__c=userName;
UC.Password__c=password;
UC.Date_of_Birth__c=dayString.format();
public string dayString {set;get;}
Method does not exist or incorrect signature: void format() from the type String