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

throwing WrongValuesException causes input field value to reset

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 5.0.11, 6.0.1
    • 5.0.7.1, 5.0.10
    • Components
    • Security Level: Jimmy
    • ZK EE 5.0.7.1

      step 1: click on save button without entering any data (you should see errorbox message)
      step 2: close errorbox1 and then errorbox2 (if you reverse the closing sequence then it will not cause this issue)
      step 3: enter some text into first textbox
      step 4: click on save again

      Expected: errorbox for 2nd textbox is shown and first textbox validation pass and value is retained
      Actual: errorbox for 2nd textbox is shown correctly but value of first textbox is reset. If you close 2nd

       
      <?xml version="1.0" encoding="UTF-8" ?>
      <zk>
      	<vlayout>
      		<hlayout>
      			<label value="First textbox"></label>
      			<textbox id="periodValue"></textbox>
      		</hlayout>
      		<hlayout>
      			<label value="Second textbox"></label>
      			<textbox id="periodValue1"></textbox>
      		</hlayout>
      		<button id="b" label="save">
      			<attribute name="onClick"><![CDATA[
      import java.util.ArrayList;
      
      import org.zkoss.lang.Strings;
      import org.zkoss.zk.ui.WrongValueException;
      import org.zkoss.zk.ui.WrongValuesException;
      
      ArrayList wve = new ArrayList();
      if(Strings.isEmpty(periodValue.getValue())) {
      	wve.add(new WrongValueException(periodValue, "Empty not allowed 1"));
      }
      if(Strings.isEmpty(periodValue1.getValue())) {
      	wve.add(new WrongValueException(periodValue1, "Empty not allowed 2"));
      }
      if (wve.size() > 0) {
      	WrongValueException[] wvea = new WrongValueException[wve.size()];
      	for (int i = 0; i < wve.size(); i++) {
      		wvea[i] = (WrongValueException) wve.get(i);
      	}
      	throw new WrongValuesException(wvea);
      }			
      			  ]]></attribute>
      		</button>
      	</vlayout>
      </zk>
      

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

              Created:
              Updated:
              Resolved: