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
NaveenReddyNaveenReddy 

Mark field as required based on other field data

Hi,
I have created a visual force page based on standard object opportunity.
My requirement is whenever I give amount filed as greater than 25000 ,the other textfield should become as required
This field should be marked as required if i enter amount as grtr than 25000 .

Can anyone plz help its urgent...
Shiva Ramesh @ xcdhrShiva Ramesh @ xcdhr

Hi

 

Try this below code:

<apex:pageBlockSection title="My Content Section" columns="2">
<apex:pageBlockSectionItem id="pBItem1">
      <apex:inputField value="{!Contact.Salary__c}">
         <apex:actionSupport event="onchange" reRender="pBItem2"/>
      </apex:inputField>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="pBItem2">
      <apex:outputLabel value="Text1"/>
      <apex:outputPanel rendered="{!Contact.Salary__c<=25000}">
           <apex:inputText value="{!Contact.Text1}"/>
      </apex:outputPanel>
      <apex:outputPanel styleClass="requiredInput" layout="block" rendered="{!Contact.Salary__c>25000}">	                                        
      <apex:outputPanel styleClass="requiredBlock" layout="block" />
           <apex:inputText value="{!Contact.Text1}"/>
      </apex:outputPanel>   
       	         </apex:pageBlockSectionItem>
</apex:pageBlockSection>