public void commandAction(Command c, Displayable d) {
        // help command displays Help Form.
        if (c == CMD_HELP) {
            HelpForm h = new HelpForm(this.midlet, this, "stocks");
            this.midlet.display.setCurrent(h);
        }

        // exit commands comes back to main menu.
        if (c == CMD_EXIT) {
            this.midlet.display.setCurrent(this.midlet.mainMenu);
        }

        // save command
        if (c == CMD_SAVE) {

            Alert alert;

            // check whether all fields have been completed
            // if not, we alert and don't do anything else.
            if (!this.isComplete()) {
                alert = new Alert("Données manquantes", "Tous les champs doivent être remplis!", null, AlertType.ERROR);
                alert.setTimeout(Alert.FOREVER);
                this.midlet.display.setCurrent (alert, this);
                return;
            }

            // create a report object from values
            StocksReport under_five = new StocksReport();
            under_five.setAll(Integer.parseInt(intrauterine_devices_initial.getString()),
                              Integer.parseInt(intrauterine_devices_used.getString()),
                              Integer.parseInt(intrauterine_devices_lost.getString()),
                              Integer.parseInt(intrauterine_devices_received.getString()),
                              Integer.parseInt(implants_initial.getString()),
                              Integer.parseInt(implants_used.getString()),
                              Integer.parseInt(implants_lost.getString()),
                              Integer.parseInt(implants_received.getString()),
                              Integer.parseInt(injections_initial.getString()),
                              Integer.parseInt(injections_used.getString()),
                              Integer.parseInt(injections_lost.getString()),
                              Integer.parseInt(injections_received.getString()),
                              Integer.parseInt(pills_initial.getString()),
                              Integer.parseInt(pills_used.getString()),
                              Integer.parseInt(pills_lost.getString()),
                              Integer.parseInt(pills_received.getString()),
                              Integer.parseInt(male_condoms_initial.getString()),
                              Integer.parseInt(male_condoms_used.getString()),
                              Integer.parseInt(male_condoms_lost.getString()),
                              Integer.parseInt(male_condoms_received.getString()),
                              Integer.parseInt(female_condoms_initial.getString()),
                              Integer.parseInt(female_condoms_used.getString()),
                              Integer.parseInt(female_condoms_lost.getString()),
                              Integer.parseInt(female_condoms_received.getString()),
                              Integer.parseInt(hiv_tests_initial.getString()),
                              Integer.parseInt(hiv_tests_used.getString()),
                              Integer.parseInt(hiv_tests_lost.getString()),
                              Integer.parseInt(hiv_tests_received.getString()),
                              Integer.parseInt(pregnancy_tests_initial.getString()),
                              Integer.parseInt(pregnancy_tests_used.getString()),
                              Integer.parseInt(pregnancy_tests_lost.getString()),
                              Integer.parseInt(pregnancy_tests_received.getString()),
                              Integer.parseInt(emergency_controls_initial.getString()),
                              Integer.parseInt(emergency_controls_used.getString()),
                              Integer.parseInt(emergency_controls_lost.getString()),
                              Integer.parseInt(emergency_controls_received.getString()),
                              intrauterine_devices_observation.getString(),
                              implants_observation.getString(),
                              injections_observation.getString(),
                              pills_observation.getString(),
                              male_condoms_observation.getString(),
                              female_condoms_observation.getString(),
                              hiv_tests_observation.getString(),
                              pregnancy_tests_observation.getString(),
                              emergency_controls_observation.getString());
            // check for errors and display first error
            if (!under_five.dataIsValid()) {
                alert = new Alert("Données incorrectes!", under_five.errorMessage(), null, AlertType.ERROR);
                alert.setTimeout(Alert.FOREVER);
                this.midlet.display.setCurrent (alert, this);
                return;
            }

            // data appears to be valid now. Let's save it.
            under_five.saveInStore();
            // refresh menu as we've changed data.
            this.midlet.refreshMenu();

            // mark report in progress
            config.set("has_data", "true");

            // Confirm data is OK and go to main menu
            alert = new Alert("Enregistré", "Les données de stocks ont été enregistrées", null, AlertType.CONFIRMATION);
            alert.setTimeout(Alert.FOREVER);
            this.midlet.display.setCurrent (alert, this.midlet.mainMenu);
        }
    }