function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Steve Gilbert 13Steve Gilbert 13 

Making a non SFDC required on a visualforce page

I am working on trying to have a field be requiered on a VF page while not being so in Salesforce. There are flows and process buidler applications that are preventing this so here is what I have:

<td><apex:inputfield value="{!ClientProfile__c.Primary_Parts_Supplier__c}" required="true" id="PrimaryPartsSupplier" /></td>

It does show as requiered but still allow me to save the page w/o a value.

Once I can get this to work, is there a way to set it so that one of 3 fields need to be completed prirot be being saves?

Thanks
Best Answer chosen by Steve Gilbert 13
MoggyMoggy
You can do this sort of validation within a custom controller writing apex code
a lot of ppl will also say that you could use javascript on your page, but this would be "code" without test classes or coverage
but if you don't have a controller and using the standard the only way to accomplish that without creating a cutom controller
but if there is already one ( assuming on your sample name) then you can built this validation you want into it

All Answers

MoggyMoggy
You can do this sort of validation within a custom controller writing apex code
a lot of ppl will also say that you could use javascript on your page, but this would be "code" without test classes or coverage
but if you don't have a controller and using the standard the only way to accomplish that without creating a cutom controller
but if there is already one ( assuming on your sample name) then you can built this validation you want into it
This was selected as the best answer
Steve Gilbert 13Steve Gilbert 13
I am stubling my way through anything code related, but there is trhe controller but it does not contain the correct fields. So, I guess the restriction would need to be built on the field somewhat to what I shown? I did this in my sandbox but even though it shows as a requiered field it will allow null values to be saved...