function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MyGodItsColdMyGodItsCold 

How do I declare a value variable for a CheckBox?

I have an apex:inputCheckBox, I'm trying to use the attribute value="{!ChkBoxVal}". In my custom controller, I declared Boolean ChkBoxVal - I tried to make it Public. I've looked around for some sample code, but failed. How do I declare it? How do I get it from page to page, like in the Wizard example?

Thanks,
Scott.MScott.M
You need to create a getter function for the variable in controller

Code:
public class someController {

  public Boolean ChkBoxVal;


  public someController() {
    this.ChkBoxVal = true;
  }

  // Getter function for the variable
  public boolean getChkBoxVal() {
    return this.ChkBoxVal;
  }

}

Now you can reference the variable in your page with {!ChkBoxVal}

Scott

 

MyGodItsColdMyGodItsCold
Thank you for your quick response. Here's what I did:

Code:
<apex:page controller="cbController">
 <apex:form>
  <apex:inputCheckbox id="cb1" value="{!cbValue}"></apex:inputCheckbox>
 </apex:form>
</apex:page>

*********************************

public class cbController {
  public Boolean cbValue;
  
  public cbController() {
    this.cbValue = true;
  }
  
  public boolean getcbValue() {
    return this.cbValue;
  }
  
}

 I got Error: Read only property 'cbController.cbValue'

Tia,
Scott.MScott.M
You need a setter for input elements to work. If you add the following function to your controller it will work

Code:
    public void setcbValue(Boolean value) {
      this.cbValue = value;
    }

Scott
MyGodItsColdMyGodItsCold
Thank you. That worked fine.
dchasmandchasman
You will all want to check out the sexy new native property syntax being released in Summer '08 - cleans up all that less than beutiful getter/setter/data member declaration code nicely!
TehNrdTehNrd
Would this be the correct way to implement these new sexy apex properties?

Code:
Old:
public class myVFcontroller {

 // A String or other simple variable
 String myName;
 
 public String getmyName(){
  return myName;
 }
 
 public void setmyName(String myName){
  this.myName = myName;
 }
 
 
 //A sObject or other custom class object
 Opportunity sourceOpp; 
  public Opportunity getsourceOpp() {
   if(sourceOpp == null){
     sourceOpp = [select Name From Opportunity where Id = :System.currentPageReference().getParameters().get('id')];
   }
   return sourceOpp;
 }
 
 //I think for sObjects you dont need setter methods as this is handled automatically— I can't quite recal.
 
}

New:
public class myVFcontroller {

 public String myName {
  get{
   return myName;
  }
  set{
   myName = value;
  }
 } 
 
 public Opportunity sourceOpp {
  get{
   if(sourceopp == null){
    sourceOpp = [select Name From Opportunity where Id = :System.currentPageReference().getParameters().get('id')];
   }
   return sourceOpp;
  }
  set{
   //Do I even need a set section–
  }
 } 
}

 Also, are there any major advantages to use this new way other than simplified code even though that is pretty good in itself?




Message Edited by TehNrd on 05-21-2008 10:35 PM
dchasmandchasman
Our goals were to simplified the code required to define properties and to keep things that belong together together. BTW your example

Code:
public String myName {
  get{
   return myName;
  }
  set{
   myName = value;
  }
 } 

can be even cooler

Code:
public String myName { get; set; }

 only scratching the surface (you can take complete control like you could with getters/setters, define get /or set specific visibility (public or private), etc) - see the documentation for much much more...


Message Edited by dchasman on 05-22-2008 08:04 AM
TehNrdTehNrd
I had a chance to look over the docs in more detail last night and I can definitely see this helping. In most of my custom controllers I have the variables at the top and then the getter/setter methods below, everything is separated and all over the place. This will definitely make the code easier to manage.
Prem ChauhanPrem Chauhan
Hi  All,
Below link will help you to get the best answer for your query regarding Apex Variable.

SALESFORCE – APEX VARIABLES (http://www.salesforceupdates.com/apex-variables-salesforce/)
http://www.salesforceupdates.com/apex-variables-salesforce/
 
Victoria CurlewisVictoria Curlewis
What a simultaneous sensation, my dick easing into Leanne's warm moist pussy, my tongue plunging back into Ally's delicious wet snatch. As I ate her this time, I reached back to place my hands on her taut butt cheeks and pull her firmly toward me.

As Leanne rode up and down on my dick, I could see her hands grasping the shoulders of her friend. Ally gyrated against my tongue, as I made long lapping motions. I could feel the rippling muscles of her ass, and I gently pulled apart her cheeks, sliding my fingers down the crack and brushing her puckered asshole. She moaned softly, as Leanne reached one hand around and cupped Ally's breast.

Of course, we didn't all come at the same time, but once it started we toppled like dominos. Sensing Ally's growing excitement, I pressed my ring finger against her tight asshole. As she slowly relaxed, I inserted it just to the first knuckle. The combined sensations were too much for her, and she cried out as she arrived at another orgasm anal porn hd sites list (https://dirtywonk.com/category/anal-porn-paysites/)

Meanwhile, Leanne changed her motion, less up and down, more forward and back, so that my dick stayed buried deep within her while her clit rubbed hard against my pubic bone. I knew this motion meant she was getting close, so I ground back against her firmly. If we were alone, she would have leaned down so her face was close to mine, but instead she leaned forward against Ally's back, reaching her arms around and holding her breasts in a big bear hug. Moments after she heard Ally's cries, Leanne climaxed herself. She made long cooing noises, and I could feel her vagina pulse in waves around my dick.

How I held out so long, I don't know. Certainly I was as aroused as I'd ever been. Perhaps I'd wanted to live up to Leanne's advance billing. In any case, once Ally came followed by Leanne, I held back no longer. I came like a volcano, erupting deep inside my wife, with a long deep groan.

Ally rolled off to my right side and Leanne to my left. We all breathed deeply, recovering from the exertion and excitement.

"Well, that was fun," Leanne said finally, smiling with her head on her arm, resting her elbow on the pillow.

"Mmm...understatement," replied Ally. A moment later, she reached for my dick, now limp and still slick with Leanne's pussy juices and my semen. Grasping the shaft with her fingers, she slowly drew back my foreskin. "Does that hurt?" she asked.

"Not at all," I told her.

"I've never been with an uncircumcised man before," she explained. She slid the foreskin back over the head of my penis. "Now you see it, now you don't," she giggled, as she repeated the motion several time, covering and uncovering my glans. Even though we'd been resting just a few minutes, this new attention began to make my dick stir again.

Noticing my growing erection, Leanne pointed and said in mock horror, "It's alive!"

"It certainly is," said Ally, then suddenly bent over and put her mouth around it, down to the base. I felt her lips slide up and down the shaft, and her tongue flick back and forth underneath porn gifs here (https://dirtywonk.com/category/porn-gifs-sites/)

"Use your hand to slide back the skin," suggested Leanne. "That way he can really feel it on the head, where he's most sensitive." Ally reached up and put this helpful advice into action, and I shuddered with pleasure as I was fully exposed to her warm moist mouth.

She broke her rhythm to ask, "You like?"

"Oh, yes, yes indeed," I assured her, breathing heavily. I was rock hard now.

"Could you do me a favor?" she asked. "Would you slide over to the edge of the bed so I can kneel on the floor? It makes me dizzy to bend my head so far down."

Much as I'd enjoyed the view of her ass swaying as she sucked my dick, I agreed that making her faint would ruin the fun. I slid around and sat on the edge of the bed, while Ally climbed to the floor and knelt before me, then engulfed me with her mouth once more.
shiang leeshiang lee

i've seen this comment a lot, those sites like

http://artiserr.com/
https://shemalehentaixtube.com/
https://3dhentaihaven.com/

always getting posted again and agian, mods should look into it