+ Start a Discussion
davecrusodavecruso 

Passing value from form/post into controller's IF

Greetings, 

 

We need to kick off a function (send update e-mail) based upon the checkbox status of a checkbox on an Apex form/page. However, it doesn't seem to be working right... is my code correct? Thanks for suggestions!

 

Apex Page Code:

 

 

<br>Check to send colleagues a notification e-mail when I save:

 

 

<apex:inputCheckbox value="{!Sendmails}" id="emailvalue"/>

 

 

 

 

 

 

Relevant Apex Controller Code:

 

 

private string Sendmails;

 

public string getSendmails() {

return Sendmails; }

 

public void setSendmails(string v) { sendmails = v; }

...

public PageReference save()

{

if (sendMails == '1') {

try{ // code here }

}

 

 

 Thanks again!

--Dave

Message Edited by davecruso on 02-03-2010 07:52 AM
Message Edited by davecruso on 02-03-2010 07:58 AM
Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard
It may be because you have a private property, but public getter/setter for it.  I seem to recall having problems with this.  Try making your property public or changing its name.  

All Answers

bob_buzzardbob_buzzard
It may be because you have a private property, but public getter/setter for it.  I seem to recall having problems with this.  Try making your property public or changing its name.  
This was selected as the best answer
davecrusodavecruso

Ah -- all set. The value of an apex:inputCheckbox is True or False, not 0 or 1. 

 

Thanks,

--Dave