You need to sign in to do that
Don't have an account?
Related to Radio button
Hi friends! help !!
I am new in SFDC please help me.
i have a list of attacement...i want that if there is only one item then radio button would be auto selected dont need to select any button. if more then one records is there then need to select one button.please help. its urgent.please give me a simple example code......thanks in advance ....please help
I am new in SFDC please help me.
i have a list of attacement...i want that if there is only one item then radio button would be auto selected dont need to select any button. if more then one records is there then need to select one button.please help. its urgent.please give me a simple example code......thanks in advance ....please help
can you share your code here so I can guide you, else you can check if list size is only 1 then onload itself you can make yoru checkbox checked adn if it is more than 1 then you can make default value of checkbox to false...
//////////////////////////// vf pafe//////////////////////////////
<apex:page standardController="Apttus_Proposal__Proposal__c" tabStyle="Apttus_Proposal__Proposal__c" extensions="ProposalExt">
<apex:form id="changeStatusForm">
<apex:pageMessages />
<apex:pageBlock >
<apex:OutputPanel rendered="{!IsValidationPass}">
<apex:pageBlockSection title="Fill Comment Detail" columns="2">
<apex:inputField value="{!Proposal.Initial_Submitter_Comment__c}" required="True" style="width:200px;height:30px;" />
</apex:pageBlockSection>
<!-- </apex:OutputPanel>
<apex:OutputPanel rendered="{!ProposalcountValue}"> -->
<apex:pageblock id="allcons" title="Select Attachment" >
<apex:pageblocktable id="allcons" value="{!AllContacts}" var="allcon">
<apex:column headervalue="Set as Primary">
<apex:actionsupport action="{!selectcon}" event="onclick" rerender="changeStatusForm,consel,allcons" Status="wait" >
<input type="radio" />
<apex:param name="conid" value="{!allcon.Id}">
</apex:param></apex:actionsupport>
</apex:column>
<apex:column headervalue="Attachment Name">
<apex:outputfield value="{!allcon.name}">
</apex:outputfield></apex:column>
</apex:pageblocktable>
</apex:pageblock>
<apex:pageblock id="consel" title="Selected Attachment" >
<apex:pageblocktable id="allcons" value="{!selectedContact}" var="selcon" >
<apex:actionStatus id="wait" startText="please wait" stopText="Done" ></apex:actionStatus>
<apex:column headervalue="Attachment Name">
<apex:outputfield value="{!selcon.name}">
</apex:outputfield></apex:column>
<apex:column headervalue="Attachment Id">
<apex:outputfield value="{!selcon.id}">
</apex:outputfield></apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:OutputPanel>
<apex:OutputPanel rendered="{!NOT(IsValidationPass)}">
<center>
<apex:outputLink value="/{!OppId}">Go to Opportunity</apex:outputLink>
<apex:outputLink value="/{!PopId}">Go to Proposal</apex:outputLink>
</center>
</apex:OutputPanel>
<apex:pageBlockButtons rendered="{!IsValidationPass}">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
/////////////////// class////////////////////////////////////
public with sharing class ProposalExt {
Public Id PopId{get;set;}
Public Id OppId{get;set;}
public boolean ProposalcountValue{get;set;}
public boolean IsValidationPass{get;set;}
public integer ProposalCount{get;set;}
public Apttus_Proposal__Proposal__c Proposal{get;set;}
public ProposalExt(ApexPages.StandardController controller) {
IsValidationPass=true;
ProposalcountValue=true;
Proposal=(Apttus_Proposal__Proposal__c )controller.getRecord();
PopId=Proposal.id;
Proposal=[Select id, Name , Initial_Submitter_Comment__c,Apttus_Proposal__Primary__c,Annualized_Total_Amount__c, Net_Effective_Rent__c, Apttus_Proposal__Opportunity__c , ROIC__c,Attachment__c from Apttus_Proposal__Proposal__c where Id=:Proposal.id];
OppId=Proposal.Apttus_Proposal__Opportunity__c;
if(Proposal.Annualized_Total_Amount__c==null || Proposal.Annualized_Total_Amount__c==0)
{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please Configure Proposal.'));
IsValidationPass=false;
// IsValidationPass=true;
}
if(Proposal.Apttus_Proposal__Primary__c== Null || Proposal.Apttus_Proposal__Primary__c==false || Proposal.Annualized_Total_Amount__c==null || Proposal.Annualized_Total_Amount__c==0)
{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please make Proposal Primary.'));
IsValidationPass=false;
//IsValidationPass=true;
}
ProposalCount=[select count() from Attachment where ParentId=:Proposal.id];
if(ProposalCount<=0)
{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please generate pdf first'));
IsValidationPass=false;
}
}
List<Attachment> selectcon;
Public List<Attachment> getAllContacts()
{
List<Attachment> allcons = [Select Id,Name from Attachment where ParentId=:PopId];
return allcons;
}
Public void selectcon()
{
String selAttachmentid = System.currentPagereference().getParameters().get('conid');
Attachment con = [Select Id,Name from Attachment where Id=:selAttachmentid ];
Proposal.Attachment__c=con.Id;
selectcon = new List<Attachment>();
selectcon.add(con);
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM, 'Attachement added successfully!!'));
}
Public List<Attachment> getselectedContact()
{
return selectcon;
}
Public PageReference Save(){
try{
update Proposal;
string strURL='/apex/Apttus_Proposal__ProposalSubmit?id=' +PopId;
PageReference ApprovalPage = new PageReference(strURL);
ApprovalPage.setRedirect(true);
return ApprovalPage ;
}catch(exception ex){
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Error,ex.getMessage());
apexpages.addmessage(msg);
return null;
}
return null;
}
}