You need to sign in to do that
Don't have an account?
Jyosi jyosi
Disable button is checkbox is false in wrapper class
Hello Everyone,
I need to disable checkbox when check box is false on visualforce page I am using wrapper class.
Below is the code
Visualforce page code
<apex:pageBlockSection collapsible="false" title="Rep Downline" rendered="{!initialStep}" columns="1">
<apex:pageblockTable value="{!contactWrapperList}" var="cont" >
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
</apex:facet>
<apex:inputCheckbox value="{!cont.Oppflagvalue}" id="inputId" immediate="true" >
<apex:actionSupport event="onclick" reRender="ButtonId" />
</apex:inputCheckbox>
</apex:column>
<apex:column headerValue="CRD#">
<apex:outputText value="{!cont.cnt.CRD__c}" />
</apex:column>
<apex:column headerValue="Rep Name">
<apex:outputText value="{!cont.cnt.Name}" />
</apex:column>
<apex:column headerValue="Downline" id="dsp" >
<apex:outputField value="{!cont.cnt.Downline__c}" />
</apex:column>
</apex:pageblockTable>
Apex command button
<apex:commandButton value="Next>>>" action="{!submitInitial}" rendered="{!initialStep}" rerender="fid"/>
Wrapper class code
public class wrapperContact{
public contact cnt {get; set;}
public Boolean Oppflagvalue{get; set;}
public boolean submitInitial{get; set;}
public wrapperContact (contact cnt) {
this.cnt = cnt;
if(cnt.Id != ApexPages.currentPage().getParameters().get('id'))
{
Oppflagvalue= false;
if(Oppflagvalue==false)
{
submitInitial=true;
}
}
else
{
Oppflagvalue= true;
submitInitial=true;
}
}
}
Can anyone please help me out
Thanks for the help in advance
Regards,
Jyo
I need to disable checkbox when check box is false on visualforce page I am using wrapper class.
Below is the code
Visualforce page code
<apex:pageBlockSection collapsible="false" title="Rep Downline" rendered="{!initialStep}" columns="1">
<apex:pageblockTable value="{!contactWrapperList}" var="cont" >
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
</apex:facet>
<apex:inputCheckbox value="{!cont.Oppflagvalue}" id="inputId" immediate="true" >
<apex:actionSupport event="onclick" reRender="ButtonId" />
</apex:inputCheckbox>
</apex:column>
<apex:column headerValue="CRD#">
<apex:outputText value="{!cont.cnt.CRD__c}" />
</apex:column>
<apex:column headerValue="Rep Name">
<apex:outputText value="{!cont.cnt.Name}" />
</apex:column>
<apex:column headerValue="Downline" id="dsp" >
<apex:outputField value="{!cont.cnt.Downline__c}" />
</apex:column>
</apex:pageblockTable>
Apex command button
<apex:commandButton value="Next>>>" action="{!submitInitial}" rendered="{!initialStep}" rerender="fid"/>
Wrapper class code
public class wrapperContact{
public contact cnt {get; set;}
public Boolean Oppflagvalue{get; set;}
public boolean submitInitial{get; set;}
public wrapperContact (contact cnt) {
this.cnt = cnt;
if(cnt.Id != ApexPages.currentPage().getParameters().get('id'))
{
Oppflagvalue= false;
if(Oppflagvalue==false)
{
submitInitial=true;
}
}
else
{
Oppflagvalue= true;
submitInitial=true;
}
}
}
Can anyone please help me out
Thanks for the help in advance
Regards,
Jyo
So basically you want to disable next if none of the checkboxes are selected, there are few ways you can achieve it,
1. Via Javascript,
2. or via controller method,
Via controller,
You can add a flag isButtonEnabled which you can set to true and re-render the commandButton, something like
In the visualforce page, the actionSupport will call this method and rerender the button
Hope this helps.
All Answers
So basically you want to disable next if none of the checkboxes are selected, there are few ways you can achieve it,
1. Via Javascript,
2. or via controller method,
Via controller,
You can add a flag isButtonEnabled which you can set to true and re-render the commandButton, something like
In the visualforce page, the actionSupport will call this method and rerender the button
Hope this helps.
It worked :)
Regards,
Jyo