0

Firstly I click the '+' icon. A new popup window opens containing the div 'modalWindow'.

Then I select product in the From the custom Product Look up which is assigned to "impactedProductName" variable.

After that click save button without providing any value to any mandatory field. An error will be shown that please provide a value to mandatory field. Then click cancel.

After that, 'impactedProductName' variable is not getting reset after reopening the pop up.

This is my code:

<div id="modalWindow" style="display: none;">
        <apex:outputPanel id="newProductBlock">

        <apex:sectionHeader title="{!IF(impactedProduct.id = null,$Label.medconnectdev2__common_new+' '+$ObjectType.Impacted_Product__c.label,$Label.medconnectdev2__common_edit+' '+$ObjectType.Impacted_Product__c.label)}" subTitle="{!impactedProduct.Product_Name__c}"/>
        <apex:form id="editForm">
        <apex:pageMessages id="newProductpageMessageBlock"/> 
        <apex:pageBlock mode="edit" id="editFormBlock" >
            <apex:outputPanel id="productEditPanel">
            <div id="errorFlag" style="display: none;">{!errorFlag}</div>
            <apex:pageBlockSection title="{!$Label.medconnectdev2__common_order} {!$Label.medconnectdev2__common_information}" rendered="{!$ObjectType.Impacted_Product__c.fields.Order__c.updateable}">
               <apex:repeat value="{!$ObjectType.Impacted_Product__c.fieldSets.Impacted_Product_Order_FieldSet}" var="f">
                    <apex:inputField value="{!impactedProduct[f.fieldPath]}"/>
                </apex:repeat>
              <!--This field is removed by fieldset
               <apex:inputField value="{!impactedProduct.Order__c}"/>-->
                <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$objecttype.Impacted_Product__c.fields.Order_Line_Item__c.label}"/>
                  <apex:actionRegion >
                    <apex:inputField value="{!impactedProduct.Order_Line_Item__c}">
                        <apex:actionSupport event="onchange" reRender="" action="{!setProductFromOLI}" status="loadStatus"/>
                    </apex:inputField>
                </apex:actionRegion>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>

            <apex:outputPanel id="productPanel" layout="block">  
             <apex:pageBlockSection title="{!$Label.medconnectdev2__common_product}/{!$Label.medconnectdev2__common_asset} {!$Label.medconnectdev2__common_information}" collapsible="false"> 
              <apex:pageBlockSectionItem rendered="{!!impactedProduct.Asset_Not_Found__c}">
                    <apex:outputLabel value="{!$ObjectType.Impacted_Product__c.fields.Asset__c.Label}"/>
                    <apex:actionRegion >
                        <apex:inputField value="{!impactedProduct.Asset__c}">
                            <apex:actionSupport event="onchange" reRender="productPanel,codeAssignmentPanel" action="{!setProductId}" status="loadStatus"/>
                        </apex:inputField>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem>
                <!--Adding Code here-->
                <apex:pageBlockSectionItem rendered="{!!impactedProduct.Asset_Not_Found__c}">
                    <apex:outputLabel value="{!$ObjectType.Impacted_Product__c.fields.Software_Version__c.Label}"/>

                    <apex:actionRegion >
                        <apex:outputField value="{!impactedProduct.Software_Version__c}">
                            <apex:actionSupport event="onchange" reRender="productPanel,codeAssignmentPanel" action="{!setProductId}" status="loadStatus"/>
                        </apex:outputField>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem rendered="{!!impactedProduct.Asset_Not_Found__c}">

                    <apex:outputLabel value="{!$ObjectType.Impacted_Product__c.fields.Hardware_Version__c.Label}"/>
                    <apex:actionRegion >
                        <apex:outputField value="{!impactedProduct.Hardware_Version__c}">
                            <apex:actionSupport event="onchange" reRender="productPanel,codeAssignmentPanel" action="{!setProductId}" status="loadStatus"/>
                        </apex:outputField>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem>
                <!--End Ants Code -->
                <apex:pageBlockSectionItem rendered="{!impactedProduct.Asset__c == NULL}" >
                    <apex:outputLabel value="{!$ObjectType.Impacted_Product__c.fields.Asset_Not_Found__c.Label}"/>
                    <apex:actionRegion >
                        <apex:inputField value="{!impactedProduct.Asset_Not_Found__c}" >
                            <apex:actionSupport event="onchange" reRender="productPanel,codeAssignmentPanel" action="{!setProductId}" status="loadStatus" oncomplete="initDateTimePicker();" />
                        </apex:inputField>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem>

                <apex:pageBlockSectionItem id="prdCode" rendered="{!impactedProduct.Asset_Not_Found__c}">
                                   <apex:outputLabel value="{!$ObjectType.Impacted_Product__c.fields.Product__c.Label}" rendered="{!impactedProduct.Asset_Not_Found__c}"/>
                                    <apex:actionRegion >
                                        <span class="lookupInput">
                                            <div class="requiredInput">
                                                <div class="requiredBlock"></div>
                                                 <apex:inputText id="prdCodeLookup"  value="{!**impactedProductName**}" >
                                                    <apex:actionSupport event="onchange" reRender="codeAssignmentPanel,manufacId,productPanel,newProductpageMessageBlock"  action="{!setImpactedProductId}" status="loadStatus" immediate="false">
                                                      <apex:param name="productOnchange" value="true" assignTo="{!productOnchange}" />
                                                    </apex:actionSupport>
                                                 </apex:inputText>                                                
                                                 <!--<apex:outputText id="prdCodeLookup1"  value="{!productCode}"/>-->
                                                <!--apex:inputHidden id="prdName" value="{!impactedProduct.Product__c}" /-->

                                                <!--<apex:image id="closeIcon" onclick="resetAssetInfoDOM();" value="/s.gif" alt="Clear" styleclass="closeIcon" rendered="{!productCode != null && foundMultipleProduct != true}"/>-->
                                                    <a href="#" onclick="openLookupPopup('{!$Component.prdCodeLookup}'); return false">
                                                    <apex:image id="lookupIcon" value="/s.gif" alt="Product Lookup (New Window)" styleclass="lookupIcon"  onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" title="Product Lookup (New Window)"/>
                                                </a>
                                            </div>
                                        </span>
                                    </apex:actionRegion>
                                </apex:pageBlockSectionItem>

            </apex:pageBlockSection>
            <apex:pageBlockSection rendered="{!impactedProduct.Asset_Not_Found__c}">
                <apex:repeat value="{!$ObjectType.Impacted_Product__c.fieldSets.Product_Details}" var="f">
                    <apex:inputField value="{!impactedProduct[f.fieldPath]}" required="{!f.required}"/>
                </apex:repeat>
                 <apex:pageBlockSectionItem >
                    <apex:outputLabel value="{!$ObjectType.Impacted_Product__c.fields.Batch_Master__c.Label}"/>
                    <apex:actionRegion >
                        <apex:inputField value="{!impactedProduct.Batch_Master__c}" >
                            <apex:actionSupport event="onchange" reRender="codeAssignmentPanel,manufacId,productPanel" action="{!populateBatchData}" status="loadStatus">
                            </apex:actionSupport>
                        </apex:inputField>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="{!$ObjectType.Impacted_Product__c.fields.Lot_Master1__c.Label}"/>
                    <apex:actionRegion >
                        <apex:inputField value="{!impactedProduct.Lot_Master1__c}" >
                            <apex:actionSupport event="onchange" reRender="codeAssignmentPanel,manufacId,productPanel" action="{!populateLotData}" status="loadStatus">
                            </apex:actionSupport>
                        </apex:inputField>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem>
                <!--<apex:outputLabel for="manufacId">{!$Label.medconnectdev2__manufacturing_location}</apex:outputLabel>
                <apex:outputPanel id="LocPanelId">-->
                 <apex:pageBlockSectionItem >
                    <apex:outputLabel value="{!$Label.medconnectdev2__asset_manufacturing_location}"></apex:outputLabel>
                    <apex:selectList size="1" value="{!impactedProduct.Manufacturing_Location__c}" id="manufacId">
                        <apex:selectOptions value="{!manufacturingLocationList}"></apex:selectOptions>
                    </apex:selectList>
                </apex:pageBlockSectionItem>
               <!-- </apex:outputPanel>-->
                </apex:pageBlockSection>
            </apex:outputpanel>
          <!--  <apex:outputpanel id="componentPanel" >
                <apex:pageBlockSection title="Product Details" columns="1" rendered="{!impactedProduct.Asset_Not_Found__c}" >
                    <c:ProductDetails sobjectValue="{!impactedProduct}" sobjectField2="MedConnectDev2__Product__c" sobjectField1="MedConnectDev2__Asset__c"
                    sobjectField4="MedConnectDev2__Lot_Master1__c" sobjectField3="MedConnectDev2__Batch_Master__c" sobjectField5="MedConnectDev2__UDI__c" /> 
                </apex:pageBlockSection>
            </apex:outputpanel>-->

                <apex:pageBlockSection id="productDetailSection" title="{!$Label.medconnectdev2__common_other} {!$Label.medconnectdev2__common_product}/{!$Label.medconnectdev2__common_asset} {!$Label.medconnectdev2__common_information}" collapsible="false">
                     <apex:repeat value="{!$ObjectType.Impacted_Product__c.fieldsets.Other_Product_Details}" var="f">
                        <apex:inputField value="{!impactedProduct[f.fieldPath]}" required="{!f.required}"/>
                     </apex:repeat>    

                     <!--  R3.3.1 changes--14.1-8 Req -->

                     <apex:pageBlockSectionItem >
                       <apex:outputLabel value="{!$Label.medconnectdev2__operator_of_device}"></apex:outputLabel>                                        
                            <apex:inputField value="{!impactedProduct.Operator_of_device__c}" onchange="DeviceOperatorLoad();">                            
                            </apex:inputField>                                        
                     </apex:pageBlockSectionItem>

                    <!-- <apex:outputPanel id="deviceOperatorPnl" rendered="{!IF(impactedProduct.Operator_of_device__c ='Other' ,true,false)}">   -->              
                      <apex:pageBlockSectionItem rendered="{!IF(impactedProduct.Operator_of_device__c ='Other' ,true,false)}" id="deviceOperatorFld">
                       <apex:outputLabel value="Device Operator (Other)  "></apex:outputLabel>                                        
                            <apex:inputField value="{!impactedProduct.Operator_of_Device_Other__c}">                            
                            </apex:inputField>                                        
                      </apex:pageBlockSectionItem>
                     <!-- </apex:outputPanel>  -->      

                    <apex:pageBlockSectionItem >
                       <apex:outputLabel value="Single Use Device"></apex:outputLabel>                                        
                            <apex:inputField value="{!impactedProduct.Is_this_a_Single_use_Device__c}" onchange="singleDeviceReload();">                            
                            </apex:inputField>                                        
                     </apex:pageBlockSectionItem>

               </apex:pageBlockSection>

              <apex:outputPanel id="ReprocessorPanel" >
                     <apex:pageBlockSection rendered="{!IF(impactedProduct.Is_this_a_Single_use_Device__c ='Yes' ,true,false)}">
                         <apex:repeat value="{!$ObjectType.Impacted_Product__c.fieldsets.Reprocessor_Section}" var="repSec" >
                            <apex:inputField value="{!impactedProduct[repSec.fieldPath]}" required="{!repSec.required}" />
                        </apex:repeat>
                     </apex:pageBlockSection>
               </apex:outputPanel>       

                <apex:pageBlockSection >
                     <apex:repeat value="{!$ObjectType.Impacted_Product__c.fieldsets.Action_to_Be_Taken}" var="f">
                         <apex:inputField value="{!impactedProduct[f.fieldPath]}" />
                     </apex:repeat>
                 </apex:pageBlockSection>                           

                <apex:pageBlockSection title="{!$Label.medconnectdev2__common_action} {!$Label.medconnectdev2__common_to} {!$Label.medconnectdev2__common_be} {!$Label.medconnectdev2__common_taken}" collapsible="false">
                     <apex:repeat value="{!$ObjectType.Impacted_Product__c.fieldsets.Action_to_Be_Taken}" var="f">
                         <apex:inputField value="{!impactedProduct[f.fieldPath]}" />
                     </apex:repeat>
                 </apex:pageBlockSection>
                 </apex:outputPanel>
                  <apex:outputPanel id="codeAssignmentPanel" layout="block" rendered="{!$ObjectType.Code_Assignment__c.createable}">
                     <apex:inputHidden value="{!codeAssignments}" id="codeAssignmentInput"/>
                     <!--<c:CodeAssignmentEdit sObjectType="MedConnectDev2__Impacted_Product__c" recordId="{!impactedProduct.Id}" targetInputId="{!$Component.codeAssignmentInput}" product="{!impactedProductId}"/>-->
                     <c:CodeAssignmentEditProdFamily sObjectType="MedConnectDev2__Impacted_Product__c" recordId="{!impactedProduct.Id}" targetInputId="{!$Component.codeAssignmentInput}" product="{!impactedProductId}"/>
                 </apex:outputPanel>
                <apex:actionFunction id="singleDeviceReload" name="singleDeviceReload"  reRender="ReprocessorPanel" status="loadStatus"></apex:actionFunction> 
                 <apex:actionFunction id="DeviceOperatorLoad" name="DeviceOperatorLoad"  reRender="productDetailSection" status="loadStatus"></apex:actionFunction> 
                 <!--<apex:actionFunction id="cancel" name="resetIPName" action="{!resetIPName}" reRender="newProductBlock" status="loadStatus" ></apex:actionFunction>--> <!--oncomplete="closePopUp();return false;"-->
                 <apex:actionFunction action="{!saveProduct}" name="dosaveProduct" reRender="isErrorPanel,RMAORelatedList,productEditPanel,productSectionPanel,newProductpageMessageBlock,newProductSection,codeAssignmentViewPanel" status="loadStatus" oncomplete="createPanelBar();checkAndClosePopUp();initDateTimePicker();"/>
                 <apex:inputhidden value="{!impactedProduct.Reason_for_Change_UI__c}" id="fldreasonForChange" rendered="{!$ObjectType.Impacted_Product__c.Fields.Reason_for_Change_UI__c.Updateable}"/>
                <apex:pageBlockButtons >
                <apex:commandButton onclick="if ({!isAuditEnabled}) { openModalPopUp('dosaveProduct'); } else { dosaveProduct();} return false;" reRender="none" value="{!$Label.medconnectdev2__common_save}" rendered="{!impactedProduct.Id <> NULL}"/>
                <apex:commandButton action="{!saveProduct}" value="{!$Label.medconnectdev2__common_save}" reRender="isErrorPanel,RMAORelatedList,productEditPanel,productSectionPanel,newProductpageMessageBlock,newProductSection,codeAssignmentViewPanel" status="loadStatus" oncomplete="createPanelBar();checkAndClosePopUp();initDateTimePicker();" rendered="{!impactedProduct.Id = NULL}"/>
                <apex:commandButton value="{!$Label.medconnectdev2__common_cancel}"  immediate="true" reRender="newProductBlock" onclick="closePopUp();return false;" /><!--onclick="closePopUp();return false;"-->
            </apex:pageBlockButtons>
        </apex:pageBlock>
        </apex:form>
        </apex:outputPanel>
    </div>   

1 Answer 1

0

You need to reset the variable impactedProductName to null or blank on click of cancel or in the event of getting an error.

Ideally this should be enough pointer for you to achieve this. But still, if you update your question with your relevant apex code, I can tell you where to write this logic.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .