Results 1 to 4 of 4

Thread: GWT Ext Combobox form submit - label provider value is going instead of key provider

  1. #1

    Default GWT Ext Combobox form submit - label provider value is going instead of key provider

    Hi,

    I have a FormPanel. Inside form panel i have a combobox. I am using UIBinder for creating my UI.

    I am creating combobox like this -

    interface TrackerActionProperties extends PropertyAccess<TrackerActionEntry> {
    ModelKeyProvider<TrackerActionEntry> actionCode();
    LabelProvider<TrackerActionEntry> actionName();
    }

    TrackerActionProperties actionProps = GWT.create(TrackerActionProperties.class);

    ListStore<TrackerActionEntry> actionListStore = new ListStore<TrackerActionEntry>(actionProps.actionCode());

    @UiField(provided = true)
    final FormPanel formPanel = new FormPanel();

    @UiField(provided = true)
    final ComboBox<TrackerActionEntry> actionCombobox = new ComboBox<TrackerActionEntry>(actionListStore, actionProps.actionName());

    On Clicking submit button -
    if (formPanel.isValid()) {
    formPanel.setMethod(Method.POST); formPanel.setEncoding(FormPanel.Encoding.MULTIPART);
    formPanel.setAction(GWT.getModuleBaseURL()+"trackerupload?trackerId="+trackerId);
    formPanel.submit();
    }

    The form is submitting directly to one of the servlet. The servlet is reading the form params in doPost method. On getting the string value for the actionCombobox (whose name is action in ui.xml file), I get the display text. For eg if my TrackerActionEntry object is (actionCode=UC,actionName=UpdateCall), then in the servlet I am getting UpdateCall instead of UC.

    Am I missing something. GXT should automatically do it for me right or I need to do it differently.

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109

    Default

    The combo box simply draws an input - when you assign that input a name, you are saying that you want the input's contents to be sent to the server under that name. The html tag <form> tells the browser, not GXT, to find all inputs, etc and pass them along under the given name with their current contents.

    To modify this behavior, don't give the combo a name, but make a Hidden object with the right name, and whenever the value changes in the combo (probably ValueChangeEvent), set a new value on that hidden.

  3. #3

    Default HiddenField not present in 3.0.0

    I was also thinking on the same line. But I am unable to locate the HiddenField in GXT 3.0.0.

  4. #4
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109

    Default

    There is no HiddenField in GXT 3. In GXT 2 we had this, but we also had several other classes that duplicated GWT functionality since our event and layout system didn't work with GWT classes. In GXT 3 this is no longer necessary, so as I said, use the GWT class Hidden.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •