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
eliotstockeliotstock 

"either/or" validation

Hi there,

 

I have a Visualforce page with two fields on it using <apex:inputField> tags. One or the other must be populated. If both are populated, that's fine too - my controller will do the right thing.

 

What's the best way to handle this? At the moment I have required="true" on both but it'd be nice to use some javascript to disable one when you click in the other. Is there anything like this out of the box in Visuaforce?

 

Best Answer chosen by Admin (Salesforce Developers) 
eliotstockeliotstock
In fact my first question should be: is there a way to make an inputField visible but disabled (using pure Visualforce tags and no javascript)?