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
DJ 367DJ 367 

rendering not working properly.

rendering not working properly.

VisualForce Page:
------------------
<apex:inputField id = "EnterValueId" Value = "{!Bd__c.Amt__c}">
    <Apex:actionSupport event = "onchange" action = "{!CheckVal}" ReRender = "TxtId" />
</Apex:inputField>

<apex:PageBlockSection id = "TxtId" rendered ={!IsGrter100} >
    <apex:inputField id="InId" required = "{!IsGrter100}" Value="{!Bd__c.TxtArea}"
</apex:PageBlockSection>

Apex:

In constructor I have set IsGrter100 value to false
IsGrter100 = false;

In the CheckVal  method I have set if Bd__c.Amt__c > 100 then IsGrter100 =true or else IsGrter100=false

Part of code:
Public PageReference CheckVal(){
    if Bd__c.Amt__c > 100 {
        IsGrter100 =true;
    }
    else{
    IsGrter100 =false;
    }
    return null;
}    

In my case when I enter more than 100 then text area gets visible and becomes mandate
but when I change the value and enter less than 100 then still text area remain required. I want when 
entered amount is more than 100 then textarea should be visible and mandate and when changing to less
than 100 then it should hide and not to be mandate.

Note: Above code is not complete and have modified littke, but remaining code is working fine except the written scenario , can 
not post complete code due to valid reason. Plese help on this. 

Thanks in advance
Dj
Mubeen QawiMubeen Qawi

 
My 2 cents:

#1 Else statement is not required. You had already declared it false
 
else{ 
     IsGrter100 =false; 
}



#2 'return null' is not required, again. I would just use 'return' statement instead