@Override
 public void onSubmit() {
   InventoryItem anItemModel = (InventoryItem) getModelObject();
   HardwareInventoryDAO aDAO =
       ((HardwareInventoryApplication) getApplication()).getSystem().getHardwareInventoryDAO();
   try {
     aDAO.modifyInventoryItem(anItemModel);
     InventoryItemView anItemView = new InventoryItemView();
     setResponsePage(anItemView);
   } catch (Exception e) {
     String errMsg =
         getLocalizer()
             .getString(
                 "login.errors.invalidCredentials ",
                 EditInventoryItem.this,
                 "Unable to modify the inventory item.");
     error(errMsg);
   }
 }
    public EditItemForm(final String id, final InventoryItem anItem) {
      super(id, new CompoundPropertyModel(anItem));

      /** edited values */
      IChoiceRenderer choiceRenderer =
          new IChoiceRenderer() {
            public String getIdValue(Object object, int index) {
              return object.toString();
            }

            public Object getDisplayValue(Object object) {
              HardwareDevice device = (HardwareDevice) object;
              return (device.getType().getNameType());
            }
          };
      DropDownChoice aDeviceList =
          new DropDownChoice("hardwareDevice", aDAO.getAllDevices(), choiceRenderer);
      add(aDeviceList);
      TextField aNameItem = new TextField("nameItem");
      add(aNameItem);
      IChoiceRenderer choiceRendererUser =
          new IChoiceRenderer() {
            public String getIdValue(Object object, int index) {
              return object.toString();
            }

            public Object getDisplayValue(Object object) {
              User aUser = (User) object;
              return aUser.getNameUser();
            }
          };
      DropDownChoice aUserList = new DropDownChoice("user", aDAO.getAllUsers(), choiceRendererUser);
      add(aUserList);
      IChoiceRenderer choiceRendererLocation =
          new IChoiceRenderer() {
            public String getIdValue(Object object, int index) {
              return object.toString();
            }

            public Object getDisplayValue(Object object) {
              LocationItemInventory aLocation = (LocationItemInventory) object;
              return aLocation.getNameLocation();
            }
          };
      DropDownChoice aLocationList =
          new DropDownChoice("location", aDAO.getAllLocations(), choiceRendererLocation);
      add(aLocationList);

      PropertyModel aInventoryDateModel = new PropertyModel(anItem, "inventoryDate");
      DateTextField aItemDate =
          new DateTextField(
              "inventoryDate", aInventoryDateModel, new PatternDateConverter("MM/dd/yyyy", true));
      DatePicker datePicker = new DatePicker();
      aItemDate.add(datePicker);
      add(aItemDate);

      TextField aPrice = new TextField("price");
      add(aPrice);
      TextField aBudget = new TextField("budget");
      add(aBudget);
      TextField aGuarantee = new TextField("guarantee");
      add(aGuarantee);

      PropertyModel aGuaranteeDateModel = new PropertyModel(anItem, "guaranteeDate");
      DateTextField aGuaranteeDate =
          new DateTextField(
              "guaranteeDate", aGuaranteeDateModel, new PatternDateConverter("MM/dd/yyyy", true));
      DatePicker GuaranteeDatePicker = new DatePicker();
      aGuaranteeDate.add(GuaranteeDatePicker);
      add(aGuaranteeDate);

      TextField aNote = new TextField("note");
      add(aNote);
    }