You need to sign in to do that
Don't have an account?
sk kumar
there are 3 nodes n1,n2,n3 are there..if i select n1 it shows aproduct node tab cpu..and again if i select cpu it will show cpu details in a popup..so any one plz help me out..urgent
<apex:page standardController="Account" extensions="productconfig5">
<apex:form >
<apex:pageblock >
<apex:panelGrid columns="5">
Select Node <apex:selectList size="1" value="{!SelectedNode}">
<apex:selectOptions value="{!SelectedNodes}"/>
<apex:actionSupport event="onchange" reRender="a"/>
</apex:selectList>
Select Product <apex:selectList size="1" value="{!product}" id="a">
<apex:selectOptions value="{!products}"/>
<apex:actionSupport event="onclick" reRender="Details"/>
</apex:selectList>
</apex:panelGrid>
<apex:outputPanel id="Details">
<apex:outputText value="The Product you Selected is {!product} " rendered="{!product != null}" />
</apex:outputPanel>
</apex:pageblock>
</apex:form>
</apex:page>
class--
public with sharing class productconfig5
{
Public String SelectedNode{get;set;}
Public String Product{get;set;}
Public String SelectedProduct{get;set;}
public productconfig5(ApexPages.StandardController controller)
{
}
public List<SelectOption> getSelectedNodes()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('None',' None'));
options.add(new SelectOption('N1','N1'));
options.add(new SelectOption('N2','N2'));
options.add(new SelectOption('N3','N3'));
return options;
}
public List<SelectOption> getProducts()
{
List<SelectOption> options =new List<SelectOption>();
if(SelectedNode == 'N1')
{
options.add(new SelectOption('CPU','CPU'));
options.add(new SelectOption('MOUSE','MOUSE'));
}
else if(SelectedNode == 'N2')
{
options.add(new SelectOption('N/W','N/W'));
}
else if(SelectedNode == 'N3')
{
options.add(new SelectOption('MONITOR','MONITOR'));
}
else
{
options.add(new SelectOption('None', 'None '));
}
return options;
}
}
<apex:form >
<apex:pageblock >
<apex:panelGrid columns="5">
Select Node <apex:selectList size="1" value="{!SelectedNode}">
<apex:selectOptions value="{!SelectedNodes}"/>
<apex:actionSupport event="onchange" reRender="a"/>
</apex:selectList>
Select Product <apex:selectList size="1" value="{!product}" id="a">
<apex:selectOptions value="{!products}"/>
<apex:actionSupport event="onclick" reRender="Details"/>
</apex:selectList>
</apex:panelGrid>
<apex:outputPanel id="Details">
<apex:outputText value="The Product you Selected is {!product} " rendered="{!product != null}" />
</apex:outputPanel>
</apex:pageblock>
</apex:form>
</apex:page>
class--
public with sharing class productconfig5
{
Public String SelectedNode{get;set;}
Public String Product{get;set;}
Public String SelectedProduct{get;set;}
public productconfig5(ApexPages.StandardController controller)
{
}
public List<SelectOption> getSelectedNodes()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('None',' None'));
options.add(new SelectOption('N1','N1'));
options.add(new SelectOption('N2','N2'));
options.add(new SelectOption('N3','N3'));
return options;
}
public List<SelectOption> getProducts()
{
List<SelectOption> options =new List<SelectOption>();
if(SelectedNode == 'N1')
{
options.add(new SelectOption('CPU','CPU'));
options.add(new SelectOption('MOUSE','MOUSE'));
}
else if(SelectedNode == 'N2')
{
options.add(new SelectOption('N/W','N/W'));
}
else if(SelectedNode == 'N3')
{
options.add(new SelectOption('MONITOR','MONITOR'));
}
else
{
options.add(new SelectOption('None', 'None '));
}
return options;
}
}
This all products are standard product?
I do it but with Standard Product Object . So, change it with you requirment (i.e. change the sObject with you custom).
VF page -
Extension :
Notify me if it'll Helped you
Regards
Virendra
class--
I have updated your existing code to call some JS. You will will need to create two more code files to save above changes
#1 Create VF page and related controller with name "ProductDetail". On controller load fetch request parameter "pName" and populate the product detail to be displayed in popup. Something like:-
ProductDetail.page
ProductDetailController.cls
There are other approches to serve your purpose but I guess it's the simple one. Let me know if it solve your issue.
Please note:
All code changes I did were in offline mode, so you may encounter trival save error.
You should not be using the product name string as option values, you should be using record ids.
Also next time please use code editor to paste code, it's really easy to do so and extremlly helpfull during review.
Visualforce Error
Help for this Page
System.QueryException: List has no rows for assignment to SObject
Error is in expression '{!productDetails}' in page productconfig6: Class.productconfig6.productDetails: line 50, column 1
Class.productconfig6.productDetails: line 50, column 1
kindly let me know..bcoz when i click the cpu option it will show the above error..plz do reply dude..thnx
Make sure you have a product name CPU.
after that run this code
If you are using my code the njust create a product from the product standard tab with name CPU.
and also feel some details.then try to this vf page.
If we talk about your code so sorry but still i don't understand that your product CPU and MOUSE are custom objects record or just static details for that.
Regards
Virendra
version7.7@hotmail.com (mailto:version7.7@hotmail.com)