You need to sign in to do that
Don't have an account?
Pegazys
apex:InputField switching values for Required Attribute
The required attribute for apex:InputField is set to true or false.
I want it to be set to true or false based on the value entered for another field
Can this be controlled using Javascript or thru the Controller Method?
You can certainly do this through the controller, but you would have to submit the changes made to the "controlling" field and then re-render the input field to update whether it is required or not. You wouldn't simply be able to make this required via javascript, as this is dictated by the styling for the field.
hi,
you can do that by calling a controller function for required attribute, like
<Apex:inputField value="{!contact.account.accountnumber}" required="{!req}" />
Controller:
public boolean getReq(){
//write your logic here
// if okay, return true, else return false
}