You need to sign in to do that
Don't have an account?

need to rerender when picklist values are chagend, but not working
page:
<apex:page standardcontroller="MPI_Category__c" extensions="MPIController1" action="{!autoRun}"
tabStyle="Contact">
<apex:form >
<apex:actionFunction name="rerenderSg1" rerender="sg1sSelectList1" >
<apex:param name="firstParam" assignTo="{!catalog}" value="" />
</apex:actionFunction>
<apex:actionFunction name="rerenderSg2" rerender="sg2sSelectList1" >
<apex:param name="firstParam" assignTo="{!sg1}" value="" />
</apex:actionFunction>
<apex:actionFunction name="rerenderSg3" rerender="sg3sSelectList1" >
<apex:param name="firstParam" assignTo="{!sg2}" value="" />
</apex:actionFunction>
<apex:actionFunction name="rerenderSg4" rerender="sg4sSelectList1" >
<apex:param name="firstParam" assignTo="{!sg3}" value="" />
</apex:actionFunction>
<apex:sectionHeader title="MPI {!mpi.name}" subtitle="MPI Item Selection" />
<apex:pageBlock >
<table><tbody>
<tr>
<th>Catalog</th>
<td>
<apex:selectList id="catalog" styleclass="std" size="1"
value="{!catalog}" onchange="rerenderSg1(this.value)" >
<apex:selectOptions value="{!catalogsSelectList}"/>
</apex:selectList>
</td>
<th>Segment1</th>
<td>
<apex:selectList id="sg1sSelectList1" styleclass="std" size="1"
value="{!sg1}" onchange="rerenderSg2(this.value)" >
<apex:selectOptions value="{!sg1sSelectList1}"/>
</apex:selectList>
</td>
<th>Segment2</th>
<td>
<apex:selectList id="sg2sSelectList1" styleclass="std" size="1"
value="{!sg2}" onchange="rerenderSg3(this.value)" >
<apex:selectOptions value="{!sg2sSelectList1}"/>
</apex:selectList>
</td>
<th>Segment3</th>
<td>
<apex:selectList id="sg3sSelectList1" styleclass="std" size="1"
value="{!sg3}" onchange="rerenderSg4(this.value)" >
<apex:selectOptions value="{!sg3sSelectList1}"/>
</apex:selectList>
</td>
<th>Segment4</th>
<td>
<apex:selectList id="sg4sSelectList1" styleclass="std" size="1"
value="{!sg4}" >
<apex:selectOptions value="{!sg4sSelectList1}"/>
</apex:selectList>
</td>
</tr>
</tbody>
</table>
<apex:commandButton action="{!addRow}" value="AddRow" rerender="pgblckID" />
<apex:commandButton action="{!clear}" value="Clear " id="theButton1" />
</apex:pageblock>
</apex:form>
</apex:page>
controller class:
public with sharing class MPIController1 {
public MPI_Category__c mpi {get;set;}
public MPI_Category__c mpiObject {get;set;}
public MPIProducts__c mpi1 {get;set;}
public Boolean sg4Bool {get;set;}
public Boolean sg3Bool {get;set;}
public Boolean sg2Bool {get;set;}
public Boolean sg1Bool {get;set;}
ApexPages.StandardController controller;
Public Boolean ShowpageBlockFlag{get;set;}
List<SelectOption> optionsca {get;set;}
List<SelectOption> options1 {get;set;}
List<SelectOption> options2 {get;set;}
List<SelectOption> options3 {get;set;}
List<SelectOption> options4 {get;set;}
public MPIController1(ApexPages.StandardController controller) {
this.controller=controller;
mpi=[Select m.Name from MPI_Category__c m where m.id= :ApexPages.currentPage().getParameters().get('id')];
mpiObject = new MPI_Category__c ();
mpiObject = (MPI_Category__c )controller.getRecord();
}
public PageReference autoRun() {
return null;
}
// Variables to store country and state selected by user
public String catalog {get; set;}
public String sg1 {get;set;}
public String sg2 {get;set;}
public String sg3 {get;set;}
public String sg4 {get;set;}
// Generates catalog dropdown from country settings
public List<SelectOption> getCatalogsSelectList()
{
optionsca = new List<SelectOption>();
optionsca.add(new SelectOption('', '--SelectOne--'));
// Find all the catalogs in the custom setting
List<product2> prd= [select id, name, MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c,MPI_Sg3__c,MPI_Sg4__c from product2 where MPI_Catalog__c!=null];
set<String> s= new Set<String>();
for(Product2 pr:prd)
{
s.add(pr.MPI_Catalog__c);
}
List<String> list1= new List<String>();
list1.addAll(s);
list1.sort();
for(String s1:list1)
{
optionsca.add(new SelectOption(s1, s1));
}
return optionsca;
}
public List<SelectOption> getSg1sSelectList1() {
System.debug('entered1-----------------------');
System.debug('entered1-catalog----------------------'+catalog);
optionsca.clear();
options1= new List<SelectOption>();
// Find all the states we have in custom settings.
List<product2> allsg1 =[select MPI_Catalog__c,MPI_Sg1__c from product2 where MPI_Catalog__c=:catalog and MPI_Catalog__c!=null];
if(allsg1.size()>0)
{
System.debug('entered11-----------------------');
// Filter states that belong to the selected country
Map<String, Product2> sg1s = new Map<String, Product2>();
for(Product2 sg19 : allsg1) {
if (sg19.MPI_Catalog__c == this.catalog) {
sg1s.put(sg19.MPI_Sg1__c, sg19);
}
}
// Sort the states based on their names
List<String> sg1Names = new List<String>();
sg1Names.addAll(sg1s.keySet());
sg1Names.sort();
System.debug('entered1---sg1Names -------'+sg1Names);
// Generate the Select Options based on the final sorted list
for (String sg1Name : sg1Names) {
Product2 state = sg1s.get(sg1Name);
System.debug('entered1---state -------'+state);
options1.add(new SelectOption(state.MPI_Sg1__c, state.MPI_Sg1__c));
}
}
// If no states are found, just say not required in the dropdown.
if (options1.size() > 0) {
options1.add(0, new SelectOption('', '--Select One--'));
} else {
options1.add(new SelectOption('', 'Not Required'));
}
return options1;
}
public List<SelectOption> getSg2sSelectList1() {
optionsca.clear();
options1.clear();
System.debug('entered2-----------------------');
options2 = new List<SelectOption>();
options2.clear();
List<product2> allsg2 =[select MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c from product2 where MPI_Sg1__c=:sg1 and MPI_Sg1__c!=null and MPI_Sg2__c!=null and MPI_Catalog__c=:catalog ];
System.debug('query is----'+[select MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c from product2 where MPI_Sg1__c=:sg1 and MPI_Sg1__c!=null and MPI_Sg2__c!=null and MPI_Catalog__c=:catalog] );
if(allsg2.size()>0)
{System.debug('entered21-----------------------'+allsg2);
// Filter states that belong to the selected country
Map<String, Product2> sg1s = new Map<String, Product2>();
for(Product2 sg11 : allsg2) {
if (sg11.MPI_Sg1__c == this.sg1) {
sg1s.put(sg11.MPI_Sg2__c, sg11);
System.debug('entered22-this.sg1----------------------'+this.sg1);
System.debug('entered22-sg11.MPI_Sg1__c----------------------'+sg11.MPI_Sg1__c);
System.debug('entered22-sg1s----------------------'+sg1s);
}
}
// Sort the states based on their names
List<String> sg1Names = new List<String>();
sg1Names.clear();
sg1Names.addAll(sg1s.keySet());
sg1Names.sort();
System.debug('entered23-sg1s----------------------'+sg1Names);
// Generate the Select Options based on the final sorted list
for (String sg1Name : sg1Names) {
Product2 state = sg1s.get(sg1Name);
options2.add(new SelectOption(state.MPI_Sg2__c, state.MPI_Sg2__c));
System.debug('options2.add1---------'+options2);
}
}
// If no states are found, just say not required in the dropdown.
if (options2.size() > 0) {
System.debug('options2.add2---------'+options2);
options2.add(0, new SelectOption('', '--Select One--'));
} else {
System.debug('options2.add3---------'+options2);
options2.add(new SelectOption('', 'Not Required'));
}System.debug('options2.add4---------'+options2);
return options2;
}
public List<SelectOption> getSg3sSelectList1() {
System.debug('entered3-----------------------');
optionsca.clear();
options1.clear();
options2.clear();
options3 = new List<SelectOption>();
options3.clear();
List<product2> allsg2 =[select MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c,MPI_Sg3__c from product2 where MPI_Sg2__c=:sg2 and MPI_Sg2__c!=null and MPI_Sg3__c!=null and MPI_Catalog__c=:catalog and MPI_Sg1__c=:sg1 ];
System.debug('sg2is-------------------'+sg2);
System.debug('allsg2 -------------------'+allsg2);
if(allsg2.size()>0)
{
// Filter states that belong to the selected country
Map<String, Product2> sg1s = new Map<String, Product2>();
for(Product2 sg12 : allsg2) {
if (sg12.MPI_Sg2__c == this.sg2) {
sg1s.put(sg12.MPI_Sg3__c, sg12);
}
}
// Sort the states based on their names
List<String> sg1Names = new List<String>();
sg1Names.clear();
sg1Names.addAll(sg1s.keySet());
sg1Names.sort();
// Generate the Select Options based on the final sorted list
for (String sg1Name : sg1Names) {
Product2 state = sg1s.get(sg1Name);
options3.add(new SelectOption(state.MPI_Sg3__c, state.MPI_Sg3__c));
}
}
// If no states are found, just say not required in the dropdown.
if (options3.size() > 0) {
options3.add(0, new SelectOption('', '--Select One--'));
} else {
options3.add(new SelectOption('', 'Not Required'));
}
return options3;
}
public List<SelectOption> getSg4sSelectList1() {
System.debug('entered4-----------------------');
optionsca.clear();
options1.clear();
options2.clear();
options3.clear();
options4 = new List<SelectOption>();
options4.clear();
List<product2> allsg2 =[select MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c,MPI_Sg3__c,MPI_Sg4__c from product2 where MPI_Sg3__c=:sg3 and MPI_Sg3__c!=null and MPI_Sg4__c!=null and MPI_Catalog__c=:catalog and MPI_Sg1__c=:sg1 and MPI_Sg2__c=:sg2];
System.debug('sg2is-------------------'+sg2);
System.debug('allsg2 -------------------'+allsg2);
if(allsg2.size()>0)
{
// Filter states that belong to the selected country
Map<String, Product2> sg1s = new Map<String, Product2>();
for(Product2 sg13 : allsg2) {
if (sg13.MPI_Sg3__c == this.sg3) {
sg1s.put(sg13.MPI_Sg4__c, sg13);
}
}
// Sort the states based on their names
List<String> sg1Names = new List<String>();
sg1Names.addAll(sg1s.keySet());
sg1Names.sort();
// Generate the Select Options based on the final sorted list
for (String sg1Name : sg1Names) {
Product2 state = sg1s.get(sg1Name);
options4.add(new SelectOption(state.MPI_Sg4__c, state.MPI_Sg4__c));
}
}
// If no states are found, just say not required in the dropdown.
if (options4.size() > 0) {
options4.add(0, new SelectOption('', '--Select One--'));
} else {
options4.add(new SelectOption('', 'Not Required'));
}
return options4;
}
public void addRow()
{
mpi1= new MPIProducts__c();
System.debug('catalog is------'+catalog);
System.debug('sg1 is------'+sg1);
System.debug('sg2 is------'+sg2);
System.debug('sg3 is------'+sg3);
System.debug('sg3 is------'+sg4);
if(catalog!=null)
{
mpi1.catlogp__c=catalog;
mpi1.Name=catalog;
}
if(sg1!=null)
{
mpi1.sg1p__c=sg1;
}
if(sg2!=null)
{
mpi1.sg2p__c=sg2;
}
if(sg3!=null)
{
mpi1.sg3p__c=sg3;
}
if(sg4!=null)
{
mpi1.sg4p__c=sg4;
}
mpi1.MPIProductLo__c=(String)mpi.id;
List<product2> itemdes=[select ProductCode,id from product2 where MPI_Catalog__c =:catalog and MPI_Sg1__c =:sg1 and MPI_Sg2__c =:sg2 and MPI_Sg3__c =:sg3 and MPI_Sg4__c =:sg4];
mpi1.ItemCode__c=itemdes[0].ProductCode;
insert mpi1;
ShowpageBlockFlag = true;
}
public pagereference clear()
{
return controller.cancel();
}
public pagereference update1()
{
update mpi1;
PageReference reRend = new PageReference('/'+mpi.id);
return reRend;
}
find the below screen shot for the same, whenever i will change 'catalog' values then that section should refresh and all sg1,sg2,sg3,sg4 as'non required'.
but it is showing with old values,
thanks in advance
}
he sa
<apex:page standardcontroller="MPI_Category__c" extensions="MPIController1" action="{!autoRun}"
tabStyle="Contact">
<apex:form >
<apex:actionFunction name="rerenderSg1" rerender="sg1sSelectList1" >
<apex:param name="firstParam" assignTo="{!catalog}" value="" />
</apex:actionFunction>
<apex:actionFunction name="rerenderSg2" rerender="sg2sSelectList1" >
<apex:param name="firstParam" assignTo="{!sg1}" value="" />
</apex:actionFunction>
<apex:actionFunction name="rerenderSg3" rerender="sg3sSelectList1" >
<apex:param name="firstParam" assignTo="{!sg2}" value="" />
</apex:actionFunction>
<apex:actionFunction name="rerenderSg4" rerender="sg4sSelectList1" >
<apex:param name="firstParam" assignTo="{!sg3}" value="" />
</apex:actionFunction>
<apex:sectionHeader title="MPI {!mpi.name}" subtitle="MPI Item Selection" />
<apex:pageBlock >
<table><tbody>
<tr>
<th>Catalog</th>
<td>
<apex:selectList id="catalog" styleclass="std" size="1"
value="{!catalog}" onchange="rerenderSg1(this.value)" >
<apex:selectOptions value="{!catalogsSelectList}"/>
</apex:selectList>
</td>
<th>Segment1</th>
<td>
<apex:selectList id="sg1sSelectList1" styleclass="std" size="1"
value="{!sg1}" onchange="rerenderSg2(this.value)" >
<apex:selectOptions value="{!sg1sSelectList1}"/>
</apex:selectList>
</td>
<th>Segment2</th>
<td>
<apex:selectList id="sg2sSelectList1" styleclass="std" size="1"
value="{!sg2}" onchange="rerenderSg3(this.value)" >
<apex:selectOptions value="{!sg2sSelectList1}"/>
</apex:selectList>
</td>
<th>Segment3</th>
<td>
<apex:selectList id="sg3sSelectList1" styleclass="std" size="1"
value="{!sg3}" onchange="rerenderSg4(this.value)" >
<apex:selectOptions value="{!sg3sSelectList1}"/>
</apex:selectList>
</td>
<th>Segment4</th>
<td>
<apex:selectList id="sg4sSelectList1" styleclass="std" size="1"
value="{!sg4}" >
<apex:selectOptions value="{!sg4sSelectList1}"/>
</apex:selectList>
</td>
</tr>
</tbody>
</table>
<apex:commandButton action="{!addRow}" value="AddRow" rerender="pgblckID" />
<apex:commandButton action="{!clear}" value="Clear " id="theButton1" />
</apex:pageblock>
</apex:form>
</apex:page>
controller class:
public with sharing class MPIController1 {
public MPI_Category__c mpi {get;set;}
public MPI_Category__c mpiObject {get;set;}
public MPIProducts__c mpi1 {get;set;}
public Boolean sg4Bool {get;set;}
public Boolean sg3Bool {get;set;}
public Boolean sg2Bool {get;set;}
public Boolean sg1Bool {get;set;}
ApexPages.StandardController controller;
Public Boolean ShowpageBlockFlag{get;set;}
List<SelectOption> optionsca {get;set;}
List<SelectOption> options1 {get;set;}
List<SelectOption> options2 {get;set;}
List<SelectOption> options3 {get;set;}
List<SelectOption> options4 {get;set;}
public MPIController1(ApexPages.StandardController controller) {
this.controller=controller;
mpi=[Select m.Name from MPI_Category__c m where m.id= :ApexPages.currentPage().getParameters().get('id')];
mpiObject = new MPI_Category__c ();
mpiObject = (MPI_Category__c )controller.getRecord();
}
public PageReference autoRun() {
return null;
}
// Variables to store country and state selected by user
public String catalog {get; set;}
public String sg1 {get;set;}
public String sg2 {get;set;}
public String sg3 {get;set;}
public String sg4 {get;set;}
// Generates catalog dropdown from country settings
public List<SelectOption> getCatalogsSelectList()
{
optionsca = new List<SelectOption>();
optionsca.add(new SelectOption('', '--SelectOne--'));
// Find all the catalogs in the custom setting
List<product2> prd= [select id, name, MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c,MPI_Sg3__c,MPI_Sg4__c from product2 where MPI_Catalog__c!=null];
set<String> s= new Set<String>();
for(Product2 pr:prd)
{
s.add(pr.MPI_Catalog__c);
}
List<String> list1= new List<String>();
list1.addAll(s);
list1.sort();
for(String s1:list1)
{
optionsca.add(new SelectOption(s1, s1));
}
return optionsca;
}
public List<SelectOption> getSg1sSelectList1() {
System.debug('entered1-----------------------');
System.debug('entered1-catalog----------------------'+catalog);
optionsca.clear();
options1= new List<SelectOption>();
// Find all the states we have in custom settings.
List<product2> allsg1 =[select MPI_Catalog__c,MPI_Sg1__c from product2 where MPI_Catalog__c=:catalog and MPI_Catalog__c!=null];
if(allsg1.size()>0)
{
System.debug('entered11-----------------------');
// Filter states that belong to the selected country
Map<String, Product2> sg1s = new Map<String, Product2>();
for(Product2 sg19 : allsg1) {
if (sg19.MPI_Catalog__c == this.catalog) {
sg1s.put(sg19.MPI_Sg1__c, sg19);
}
}
// Sort the states based on their names
List<String> sg1Names = new List<String>();
sg1Names.addAll(sg1s.keySet());
sg1Names.sort();
System.debug('entered1---sg1Names -------'+sg1Names);
// Generate the Select Options based on the final sorted list
for (String sg1Name : sg1Names) {
Product2 state = sg1s.get(sg1Name);
System.debug('entered1---state -------'+state);
options1.add(new SelectOption(state.MPI_Sg1__c, state.MPI_Sg1__c));
}
}
// If no states are found, just say not required in the dropdown.
if (options1.size() > 0) {
options1.add(0, new SelectOption('', '--Select One--'));
} else {
options1.add(new SelectOption('', 'Not Required'));
}
return options1;
}
public List<SelectOption> getSg2sSelectList1() {
optionsca.clear();
options1.clear();
System.debug('entered2-----------------------');
options2 = new List<SelectOption>();
options2.clear();
List<product2> allsg2 =[select MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c from product2 where MPI_Sg1__c=:sg1 and MPI_Sg1__c!=null and MPI_Sg2__c!=null and MPI_Catalog__c=:catalog ];
System.debug('query is----'+[select MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c from product2 where MPI_Sg1__c=:sg1 and MPI_Sg1__c!=null and MPI_Sg2__c!=null and MPI_Catalog__c=:catalog] );
if(allsg2.size()>0)
{System.debug('entered21-----------------------'+allsg2);
// Filter states that belong to the selected country
Map<String, Product2> sg1s = new Map<String, Product2>();
for(Product2 sg11 : allsg2) {
if (sg11.MPI_Sg1__c == this.sg1) {
sg1s.put(sg11.MPI_Sg2__c, sg11);
System.debug('entered22-this.sg1----------------------'+this.sg1);
System.debug('entered22-sg11.MPI_Sg1__c----------------------'+sg11.MPI_Sg1__c);
System.debug('entered22-sg1s----------------------'+sg1s);
}
}
// Sort the states based on their names
List<String> sg1Names = new List<String>();
sg1Names.clear();
sg1Names.addAll(sg1s.keySet());
sg1Names.sort();
System.debug('entered23-sg1s----------------------'+sg1Names);
// Generate the Select Options based on the final sorted list
for (String sg1Name : sg1Names) {
Product2 state = sg1s.get(sg1Name);
options2.add(new SelectOption(state.MPI_Sg2__c, state.MPI_Sg2__c));
System.debug('options2.add1---------'+options2);
}
}
// If no states are found, just say not required in the dropdown.
if (options2.size() > 0) {
System.debug('options2.add2---------'+options2);
options2.add(0, new SelectOption('', '--Select One--'));
} else {
System.debug('options2.add3---------'+options2);
options2.add(new SelectOption('', 'Not Required'));
}System.debug('options2.add4---------'+options2);
return options2;
}
public List<SelectOption> getSg3sSelectList1() {
System.debug('entered3-----------------------');
optionsca.clear();
options1.clear();
options2.clear();
options3 = new List<SelectOption>();
options3.clear();
List<product2> allsg2 =[select MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c,MPI_Sg3__c from product2 where MPI_Sg2__c=:sg2 and MPI_Sg2__c!=null and MPI_Sg3__c!=null and MPI_Catalog__c=:catalog and MPI_Sg1__c=:sg1 ];
System.debug('sg2is-------------------'+sg2);
System.debug('allsg2 -------------------'+allsg2);
if(allsg2.size()>0)
{
// Filter states that belong to the selected country
Map<String, Product2> sg1s = new Map<String, Product2>();
for(Product2 sg12 : allsg2) {
if (sg12.MPI_Sg2__c == this.sg2) {
sg1s.put(sg12.MPI_Sg3__c, sg12);
}
}
// Sort the states based on their names
List<String> sg1Names = new List<String>();
sg1Names.clear();
sg1Names.addAll(sg1s.keySet());
sg1Names.sort();
// Generate the Select Options based on the final sorted list
for (String sg1Name : sg1Names) {
Product2 state = sg1s.get(sg1Name);
options3.add(new SelectOption(state.MPI_Sg3__c, state.MPI_Sg3__c));
}
}
// If no states are found, just say not required in the dropdown.
if (options3.size() > 0) {
options3.add(0, new SelectOption('', '--Select One--'));
} else {
options3.add(new SelectOption('', 'Not Required'));
}
return options3;
}
public List<SelectOption> getSg4sSelectList1() {
System.debug('entered4-----------------------');
optionsca.clear();
options1.clear();
options2.clear();
options3.clear();
options4 = new List<SelectOption>();
options4.clear();
List<product2> allsg2 =[select MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c,MPI_Sg3__c,MPI_Sg4__c from product2 where MPI_Sg3__c=:sg3 and MPI_Sg3__c!=null and MPI_Sg4__c!=null and MPI_Catalog__c=:catalog and MPI_Sg1__c=:sg1 and MPI_Sg2__c=:sg2];
System.debug('sg2is-------------------'+sg2);
System.debug('allsg2 -------------------'+allsg2);
if(allsg2.size()>0)
{
// Filter states that belong to the selected country
Map<String, Product2> sg1s = new Map<String, Product2>();
for(Product2 sg13 : allsg2) {
if (sg13.MPI_Sg3__c == this.sg3) {
sg1s.put(sg13.MPI_Sg4__c, sg13);
}
}
// Sort the states based on their names
List<String> sg1Names = new List<String>();
sg1Names.addAll(sg1s.keySet());
sg1Names.sort();
// Generate the Select Options based on the final sorted list
for (String sg1Name : sg1Names) {
Product2 state = sg1s.get(sg1Name);
options4.add(new SelectOption(state.MPI_Sg4__c, state.MPI_Sg4__c));
}
}
// If no states are found, just say not required in the dropdown.
if (options4.size() > 0) {
options4.add(0, new SelectOption('', '--Select One--'));
} else {
options4.add(new SelectOption('', 'Not Required'));
}
return options4;
}
public void addRow()
{
mpi1= new MPIProducts__c();
System.debug('catalog is------'+catalog);
System.debug('sg1 is------'+sg1);
System.debug('sg2 is------'+sg2);
System.debug('sg3 is------'+sg3);
System.debug('sg3 is------'+sg4);
if(catalog!=null)
{
mpi1.catlogp__c=catalog;
mpi1.Name=catalog;
}
if(sg1!=null)
{
mpi1.sg1p__c=sg1;
}
if(sg2!=null)
{
mpi1.sg2p__c=sg2;
}
if(sg3!=null)
{
mpi1.sg3p__c=sg3;
}
if(sg4!=null)
{
mpi1.sg4p__c=sg4;
}
mpi1.MPIProductLo__c=(String)mpi.id;
List<product2> itemdes=[select ProductCode,id from product2 where MPI_Catalog__c =:catalog and MPI_Sg1__c =:sg1 and MPI_Sg2__c =:sg2 and MPI_Sg3__c =:sg3 and MPI_Sg4__c =:sg4];
mpi1.ItemCode__c=itemdes[0].ProductCode;
insert mpi1;
ShowpageBlockFlag = true;
}
public pagereference clear()
{
return controller.cancel();
}
public pagereference update1()
{
update mpi1;
PageReference reRend = new PageReference('/'+mpi.id);
return reRend;
}
find the below screen shot for the same, whenever i will change 'catalog' values then that section should refresh and all sg1,sg2,sg3,sg4 as'non required'.
but it is showing with old values,
thanks in advance
}
like,
<apex:actionsupport event="onchange" action="invoke some method if you need" rerender="sg2sSelectList1" >
try using the action support tag...
<apex:selectlist>
<apex:actionSupport>
</apex:actionSupport>
<apex:selectOptions>
</apex:selectOptions>
</apex:selectlist>