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

Action of click of command button
Hi,
I have a VF page which has a list of email ids listed as checkboxes. I have 3 buttons:
1. TO - which adds the selected emails to TO list
2. CC - which adds the selected emails to CC list
3. Next - which redirects to Send Email page.
But i am facing a problem, when i click on any of the button nothing happens.... page just gets refreshed. Though i have few debug statements in my action methods nothing comes in logs.
VF page is:
<apex:page controller="conAddmailsIds" >
<apex:form >
Select Emails Ids:
<!-- <apex:selectRadio value="{!emailToAdd}" > <br/> -->
<apex:selectCheckboxes value="{!emailToAdd}">
<apex:selectOption itemLabel="manasa.r@hp.com" itemValue="manasa.r@hp.com"></apex:selectOption><br/>
<apex:selectOption itemLabel="manasa.r.gupta@gmail.com" itemValue="manasa.r.gupta@gmail.com"></apex:selectOption>
<apex:selectOption itemLabel="abc@def.com" itemValue="abc@def.com"></apex:selectOption>
<apex:selectOption itemLabel="ghi@jkl.com" itemValue="ghi@jkl.com"></apex:selectOption>
<apex:selectOption itemLabel="mno@pqr.com" itemValue="mno@pqr.com"></apex:selectOption>
</apex:selectCheckboxes>
<!-- </apex:selectRadio> -->
<apex:commandButton value="To" action="{!addToList}"/>
<apex:commandButton value="CC" action="{!addCCList}"/>
<br/> Selected aditional TO email ID is : {!toList}
<!-- <apex:dataList value="{!toList}" var="c">{!c}</apex:dataList> -->
<br/> Selected CC email ID is : {!ccList} <!-- <apex:dataList value="{!ccList}" var="c">{!c}</apex:dataList> -->
<br/> <apex:commandButton value="Next" action="{!conAddEmailsIds}"/>
</apex:form>
</apex:page>
Apex code:
public class conAddmailsIds{
public String [] emailToAdd{get;set;}
public String [] toList{get;set;}
public String [] ccList{get;set;}
public Pagereference conAddEmailsIds(){
system.debug('@@@@@@ in add'+toList);
PageReference p = new PageReference('/_ui/core/email/author/EmailAuthor?p24='+toList+'&p4='+ccList);
return p;
}
public Pagereference addToList(){
system.debug('@@@@@@ in to list'+emailToAdd);
toList = emailToAdd;
return null;
}
public Pagereference addCCList(){
ccList = emailToAdd;
return null;
}
}
Can anyone help me to figure out when there no action on click of button?
Regards,
Manasa
public Pagereference conAddEmailsIds(){
system.debug('@@@@@@ in add'+toList);
PageReference p = new PageReference('/_ui/core/email/author/EmailAuthor?p24='+toList+'&p4='+ccList);
p.setRedirect(true);
return p;
}
Sorry, it didnt work.
Value is not even getting for emailToAdd.
Action is not invoking addToListmethod itself.
The page simply refreshes by default when you don't add them.
Hey
I have modified some of it. Check it out.
Try to execute the above VF page and Apex class, it works now. I did some changes to your code.