You need to sign in to do that
Don't have an account?
YV
<apex:page standardController="Position__c">
<apex:form>
<apex:pageMessages/>
<apex:pageBlock title="Position">
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="save"/>
<apex:commandButton action="{Cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Create records">
<apex:inputText value="{!position__c.name}" />
<apex:inputText value="{!position__c.min_pay__c}" />
<apex:inputText value="{!position__c.max_pay__c}" />
<apex:inputText value="{!position__c.status__c}" />
<apex:inputText value="{!position__c.job_description__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
if i edit this page and save without do anything it will also accept values and will take $0.0 value in min and max pay fields
Please help me
Thank you in advance
Why i am able to save records through visualforce page even there are some required fields and some have active validation rule ?
- I created a Visualforce page and added standard controller position__c object. There are some required fields like name,min_pay and max_pay. Min and max pay both have validation rule to check the minimum value criteria. Without entering value in input text on visualforce page on those fields why i am able to save records.
<apex:page standardController="Position__c">
<apex:form>
<apex:pageMessages/>
<apex:pageBlock title="Position">
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="save"/>
<apex:commandButton action="{Cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Create records">
<apex:inputText value="{!position__c.name}" />
<apex:inputText value="{!position__c.min_pay__c}" />
<apex:inputText value="{!position__c.max_pay__c}" />
<apex:inputText value="{!position__c.status__c}" />
<apex:inputText value="{!position__c.job_description__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
if i edit this page and save without do anything it will also accept values and will take $0.0 value in min and max pay fields
Please help me
Thank you in advance
As you are using standard controller ,below is what you should check out .
https://help.salesforce.com/articleView?id=000331023&mode=1&type=1
But this can be done with extensions and custom controllers .
Below is code for reference Apex class :
Because you are using the apex:inputText . If you use <apex:inputField> then it will automatically consider the field properties.
If you want to use the <apex:inputText> then you have to write the extenson controller.
Please try the below and let me know .
Thanks,
Maharajan.C
I tried all the things like i used inputfields and also use <apex:messages/> on pageBlock but it didn't work out.
Please help somebody i stuck here and confused
Please use below code: Apex class:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
I tried your code but there are some errors. and i am unable to solve those errors.