Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-218

Validation of inputfield resets other non-validated inputfields when databinding is active

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Normal Normal
    • None
    • 5.0.6, 5.0.7
    • Components, Databind
    • None

      When i have a form with multiple input fields with a constraint (e.g. "no empty") and databinding is active for these input fields, the following behavior can be produced:
      1. Enter a value into the first field and lose focus
      2. Delete the value again so the field is empty and lose focus -> the constraint triggers correctly
      3. Enter a value into the second field and lose focus -> the first input field resets itself to the last validated value and is no longer marked as invalid

      This can be reproduced on the demo page http://www.zkoss.org/zksandbox/#d1 with the following changes to the demo code:

      <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./mywin"?>
      <window id="mywin" border="none">
      ZK name check list :
      <zscript>
      //init example data beans
      import org.zkoss.zksandbox.Person;
      List persons = new ArrayList();
      persons.add(new Person("Balu", "Haben"));
      persons.add(new Person("Sadira", "Jobs"));
      persons.add(new Person("Dacey", "Obert"));
      persons.add(new Person("Gabby", "Taffy"));
      Person selected = persons.get(0);
      </zscript>

      <listbox model="@

      {persons}

      " selectedItem="@

      {selected}

      " rows="5">
      <listhead >
      <listheader label="Name"/>
      </listhead>
      <listitem self="@

      {each=person}

      " label="@

      {person.fullName}

      " />
      </listbox>
      <grid>
      <columns>
      <column label="First Name" />
      <column label="Last Name" />
      <column label="Full Name" />
      </columns>
      <rows>
      <row>
      <textbox value="@

      {selected.firstName}

      " constraint="no empty"/>
      <textbox value="@

      {selected.lastName}

      " constraint="no empty"/>
      <label value="@

      {selected.fullName}

      " />
      </row>
      </rows>
      </grid>
      </window>

            benbai benbai
            cypha cypha
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: