+ Start a Discussion

Fetching required fields from custom object to visual force page

Hi , 

i have a custom object PROJECT . I created a visual force page which is a mirror of PROJECT page layout .
now I want the required field validations on the object to be displayed on visual force page. 

I used "required = true" on my input field , it gave me the red bar in the field but when I click save without filling the required field the page does not show error message and the record is not saved. 

Can an any body help me?
What is happening after clickin the SAVE button? Did you include the <Apex:Form> tag in your VF page?
Hey Rahul ,

i used standard controller = project__c and extension = projcontroller

i have written my own save method in extension controller

after clicking save it will won't validate anything. If all the mandatory fields are filled the record is saved if I miss any one mandatory field the record will not get saved. 

I have given a pagereference after save method . It successfully goes to the new page reference though record is created or not.
Anil SavaliyaAnil Savaliya

Did you add <apex:pagemessage/> ?
Yea I have added this tag in my visualforce page...but finally i figured out whats causing the problem but i could not find the solution for this...i raised a ticket for this to salesforce.......

so when i use <apex:commandButton value="Save" action="{!Save}" onComplete="refreshParentWindow()"/>
on click of save the mandatory field validations are not checked but

when i use <apex:commandButton value="Save" action="{!Save}" />
the mandatory field validations are checked after click of "save"

I have to use the javascriipt function on "onComplete" as shown above...but it see that the mandatory field validation is not done if i use the onComplete property.....will have to wait for the case comments