+ Start a Discussion
Kelly CordillKelly Cordill 

Increment Button not displaying in Creating a Controller Extension

I'm stuck on Creating a Controller Extension.  My increment button is not displaying and I've started the exercise over from scratch now 3 times.
What am I missing that the button does not appear?
Atul GuptaAtul Gupta
Kelly, can you give a little more information about this increment button. What exactly is it supposed to do?

Are you referring to some trailhead exercise?
Kelly CordillKelly Cordill
It is a Trailhead exercise Step 1: Create a Controller extension In this step, you experiment with the mechanics of a controller extension. You create a simple controller extension that exposes an increment() method and a counter property. When you click the Increment button in the SpeakerForm page, the extension's increment() method increments the counter property whose new value is automatically displayed in the page. In the next step, you make SpeakerControllerExtension a lot more useful by adding code to support the upload of speaker pictures. 1. In the Developer Console, select File > New > Apex Class, specify SpeakerControllerExtension as the class name and click OK. 2. Implement the class as follows: view source print? 01 public with sharing class SpeakerControllerExtension { 02 03 public Integer counter {get; set;} 04 05 private final Speaker__c speaker; 06 private ApexPages.StandardController stdController; 07 08 public SpeakerControllerExtension(ApexPages.StandardController stdController) { 09 this.speaker = (Speaker__c)stdController.getRecord(); 10 this.stdController = stdController; 11 counter = 0; 12 } 13 14 public void increment() { 15 counter++; 16 } 17 18 } 3. Save the file. 4. In the Developer Console, open the SpeakerForm page, and add the controller extension to the page definition: view source print? 1 5. Add an Increment button (right after the Save button): view source print? 1 6. Display the counter (right after ): view source print? 1 {!counter} 7. Save the file. 8. Test the application. · Click the Speakers tab, select a speaker, and click Edit. · Click the Increment button several times and watch the counter value displayed at the bottom of the page.
Tom Kelly 8Tom Kelly 8
Same problem here
Patricia Boyce 6Patricia Boyce 6
And here!