Re: Hello Everyone !! Visualforce Page Issue !!

29 views
Skip to first unread message

Harika P

unread,
Nov 27, 2013, 9:02:54 AM11/27/13
to salesforce-p...@googlegroups.com
Hello...
 
  Please see the attached screen shots of my requirement.  

Requirement : If Field 'Record Type 1' = 'Parts' the 'Summary' Field input is mandatory. 

I am able to get the error message but it is not working as desired. As you can see in the 'VFPage2' image , even for the 'Record Type 1'= 'End User' it is showing Validation error on Summary.

VF Page : please see the below red color code ..

<apex:pageBlockSectionItem >
                <apex:outputLabel value="Record Type 1"/>
              <apex:inputField value="{!case.Record__c}" onchange="setRequired();"/>             
             </apex:pageBlockSectionItem>                  
           
           <apex:pageBlockSectionItem >
                <apex:outputLabel value="Record Type 2" />
                <apex:inputField value="{!case.Record_Type_22__c}" />                    
            </apex:pageBlockSectionItem>                    
        </apex:pageBlockSection>
        <apex:pageBlockSection columns="2" rendered="true" title="Case Info" id="thePageBlockSection">
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Subject" />
                <apex:inputField value="{!case.Subject}" />                    
            </apex:pageBlockSectionItem>    
-------------------------------
 -------------------------------------------------
------------------------------------------
     <apex:actionFunction name="reRenderBlock" rerender="block1"/>
       <apex:inputField id="Summary"  value="{!case.Summary__c}" required="{!case.Record__c == 'Parts'}"/>
   
   <script>
function setRequired(){
    if(document.getElementById('{!$Component.form1.block1.thePageBlockSection.Summary}').value == '') 
     reRenderBlock();
    }
    </script>

Thanks in advance...
 
 
 
Regards,
Harika
 


On Mon, Nov 25, 2013 at 4:18 PM, Harika P <parepall...@gmail.com> wrote:
Hello  !! 

I have a requirement on a VF Page, How to make a Field named"Summary" Mandatory, Based on the Picklist field value "Parts". Both fields belong to two diff objects placed in two diff page block section. Can anyone assist in this regard. Thanks in advance.

              

 
    
 
 


VFpage1.PNG
VFPage2.PNG

Ravindra Babu Nagaboina

unread,
Nov 28, 2013, 5:18:29 AM11/28/13
to salesforce-p...@googlegroups.com
make these changes,
1. add a attribute to actionfunction, " immideate = "true" "

2. add a new Boolean property in controller, 
public Boolean isRecordTypeCheck {get;set;}

3. in actionFunction action method check what is the value of "Record Type 1"
.....
if(case.Record_Type_1__c == 'parts'){
isRecordTypeCheck = true;
}else{
isRecordTypeCheck = false;
}
4. change the inputField to like this,
<apex:inputField id="Summary" value="{!case.summary__c}" required="{!isRecordTypeCheck }" />

Try like this


--
You received this message because you are subscribed to the Google Groups "salesforce professionals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salesforce-profess...@googlegroups.com.
To post to this group, send email to salesforce-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/salesforce-professionals.
For more options, visit https://groups.google.com/groups/opt_out.



--
Thanks & Regards.
Ravindra Babu Nagaboina


Reply all
Reply to author
Forward
0 new messages