Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    selectItem.disable() and form.submitForm()

    Hi Isomorphic,

    I make selectItem.disabled() in form dynamically (under condition). In UI all is ok, but when I invoke form.submitForm() send selected value from selectItem. I check rendered page and see that in html tag <input type="hidden" name="selectItem" id="isc_8O" value="13213"> missing the attribute disabled !

    #2
    We're not sure what this means. Our SelectItems are composed of multiple HTML elements and they don't look as you describe. Also the ARIA markup used by screenreaders is already correct.

    You may be using some other framework and posted on the wrong forums?

    If it turns out you are actually using SmartClient, we would need to know:

    1. what edition and version (full, including build date)

    2. what problem this is actually causing in your app (as in, what goes wrong for the end user)

    3. sample code that causes the HTML to be generated as you describe

    Comment


      #3
      isc.version: 'v13.0p_2023-02-11/LGPL Development Only'

      Code:
      public class FormUI extends DynamicForm {
        protected TextItem tiTextItem1 = new TextItem("textItem1");
      
        protected TextItem tiTextItem2 = new TextItem("textItem2");
      
        protected SelectItem siSelectItem = new SelectItem("selectItem");
      
        protected ButtonItem biSubmit = new ButtonItem("submitForm", "Submit");
      
        public FormUI() {
          setIsGroup(true);
          setGroupTitle("<b>Form</b>");
          setWidth(800);
          setHeight(250);
          setNumCols(3);
          setColWidths("30%", "40%", "30%");
          setPadding(18);
          setCellPadding(8);
      
          setMethod(FormMethod.POST);
          setEncoding(Encoding.MULTIPART);
          setCanSubmit(true);
          setAction(GWT.getHostPageBaseURL() + "service");
      
          tiTextItem1.setStartRow(true);
          tiTextItem1.setDefaultValue("Text1");
      
          tiTextItem2.setStartRow(true);
          tiTextItem2.setDefaultValue("Text2");
          tiTextItem2.disable();
      
          siSelectItem.setMultiple(false);
          siSelectItem.setValueMap("Option1", "Option2", "Option3", "Option4");
          siSelectItem.setDefaultValue("Option1");
          siSelectItem.disable();
      
          biSubmit.setStartRow(false);
          biSubmit.setEndRow(true);
          biSubmit.setWidth(150);
          biSubmit.setAlign(Alignment.CENTER);
          biSubmit.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              submitForm();
            }
          });
      
          setItems(tiTextItem1, biSubmit, tiTextItem2, siSelectItem);
        }
      }
      The problem is that after submit form data payload contains selectItem even though it is disabled.
      For additional info see attachments
      Attached Files
      Last edited by tanas@abv.bg; 19 Oct 2024, 11:38.

      Comment


        #4
        "disabled" is a UI-level concept and means that the end user cannot interact with or change the value. It does not affect the data that is submitted to the server; indeed, data submitted to the server includes a lot of data that is never visible to the user at all (dsRequest.oldValues, various metadata, etc).


        Comment


          #5
          Interestingly, for TextItem and ComboBoxItem the disable() method has an effect (not sent to the server), but for SelectItem it doesn't work. Why?

          Comment

          Working...
          X