You need to sign in to do that
Don't have an account?
Error to through before save button.
Hi
I have created a class called "credit check" and i have a visual force page for this.I want to create a condition under which if the fields are empty and when i try to save it,should through an error for that condition.
As i have written the condition in class credit check and i have VF page and connect it to the controller creditcheck.cls.But here i am facing the issue,that the record is saving and at the top of Save button the error comes up and when i edit it, then it shows me the field which all i have not filled.What should i do to through the error before the record is saved.
I know it can be done by the trigger(before insert, before update).But i want this to be done in the class.
Help me
Thanks
Nasir
Is there a reason why you can't use the required attribute on the inputfields themselves? That would be handled by the platform rather than you having to write custom code.
You can use salesforce class 'errorMsg' to handle this functionality.
Tryout the sample code given below :
<div class="errorMsg" style="display:none">
<strong> Error: </strong>You must enter a value
</div>
Hope this helps.
Hi,
yes i am trying to use Required attribute for this but some how when i am clicking save,it is not saving and the error message is "
"
The condition is this
If "Business Type" = Limited Company/Plc/Charity & New Supplier = Eon & the "Product" not equal to "Bespoke" then the following fields must be completed:
Account Name
Company Registered Number or Charity Number
Date of Incorporation
Company Registered Address
Billing Address
Phone
I can't see why that code would cause that save error. When I've hit unknown property errors in the past, it normally means I've misspelled the field name.