public void commandAction(Command c, Displayable d) {
        // help command displays Help Form.
        if (c == CMD_HELP) {
            HelpForm h = new HelpForm(this.midlet, this, "stock_outs");
            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
            MalariaStockOutsReport stock_outs = new MalariaStockOutsReport();
            stock_outs.setAll(fieldValue(stockout_act_children),
                              fieldValue(stockout_act_youth),
                              fieldValue(stockout_act_adult),
                              fieldValue(stockout_artemether),
                              fieldValue(stockout_quinine),
                              fieldValue(stockout_serum),
                              fieldValue(stockout_bednet),
                              fieldValue(stockout_rdt),
                              fieldValue(stockout_sp));
            // check for errors and display first error
            if (!stock_outs.dataIsValid()) {
                alert = new Alert("Données incorrectes!", stock_outs.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.
            stock_outs.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 ruptures de stock ont été enregistrées", null, AlertType.CONFIRMATION);
            alert.setTimeout(Alert.FOREVER);
            this.midlet.display.setCurrent (alert, this.midlet.mainMenu);
        }
    }