Input validation error when fire setValueListItem

the case is like this:

i have a field with is NOT NULL and i put this field into one element with type is COMBOBOX with custom valuelist attach;

the valuelist data will keep change with condition.

when I try to use application.setValueListItem on this valuelist and application.showFormInDialog, it will cause an input validation error which is NULL input. the problem is, the data I used to for application.setValueListItem neither contain any empty nor NULL value.
so I wondering is there any way for me to solve this problem without changing my current code.

I do not have such error above if I do not call application.showFormInDialog on my method.

note: the element I used only appear when I used application.ShowFormInDialog and application.setValueListItems is fire b4 application.ShowFormInDialog and the element on that time is still hidden.

Servoy version 3.5.1 with java version 1.6.02 used

thank you.

Do you have a short code snippet/extract of the relevant areas in your method that you can post?

method i fire, let say in form.psCore_User.

var vTableName = foundset.getTableName();
var vPKNames = [“securitycapability_id”, “user_id”];
var query = globals.gCore_m_getQueryString(vTableName, vPKNames);
var vSQLParams = new Array()
vSQLParams[0] = securitycapability_id;
vSQLParams[1] = fUserID;

forms.psCore_UserSetupFormRightsDialogs.foundset.loadRecords(query, vSQLParams);
forms.psCore_UserSetupFormRightsDialogs.doEdit();
application.showFormInDialog(forms.psCore_UserSetupFormRightsDialogs, -1, -1, -1, -1, “User Rights”, false, false, “UserRights”, true);

forms.psCore_UserSetupFormRightsDialogs.doEdit();

application.setStatusText(“Loading data for valuelist …”);

var vListName = elements.fld_action_rights_target.getValueListName();
var vListNameLevel = elements.fld_action_rights_level.getValueListName();

// predefined array name
var vListNameSource = globals.gCore_m_UserRights(true, securitycapability_id, “mTarget”,
new Array(vListNameLevel, action_rights_level))

var dataset = application.getValueListItems(vListNameSource);

var vDisplayArray = new Array();
var vRealArray = new Array();

vDisplayArray[0] = “(All)”;
vRealArray[0] = “(All)”;
vDisplayArray[1] = “-”;
vRealArray[1] = “-”;

var vRealValue = foundset.getDataProviderValue(elements.fld_action_rights_target.getDataProviderID());
var vGotData = false;

var vLength = dataset.getMaxRowIndex();

if (vLength > 0)
{
var i = 0, j = 0;
if (vLength > 200)
application.updateUI();

for (i = 1, j = 2; i <= vLength; i++, j++)
{
vDisplayArray[j] = dataset.getValue(i, 1).toString();
vRealArray[j] = dataset.getValue(i, 2).toString();
if (vRealArray[j] == vRealValue)
vGotData = true;
}
}

if (!vGotData)
vRealValue = vRealArray[0];

if (application.getValueListDisplayValue(vListName, vRealValue) != null)
foundset.setDataProviderValue(elements.fld_action_rights_target.getDataProviderID(), vRealValue);
application.setValueListItems(vListName, vDisplayArray, vRealArray);

The above method cause input validation fail when the valuelist data length longer than 24.

Can you give the full stacktrace?

  1. Does this happen all the time or maybe only the first time?
  2. Could it be that your real values are of the wrong data type?
  3. What data type are your real values and what type is the column?

Do you call …doEdit() from the dialog form you are having this error?

Also, you test for null. I have run into situations with these methods where string length = 0 (or ! var_name/obj_name)) performs a more thorough test … as you do in !vGotData.

Have you checked that the dataset (presumably ok from the global loader) is properly filled within the context of the loaded form?

I am wondering about your context/scope for variables.

This is the error log I get.

java.lang.IllegalArgumentException: Validation failed for ‘action_rights_target’, with value: null
at com.servoy.j2db.dataprocessing.av.if(Unknown Source)
at com.servoy.j2db.dataprocessing.aw.setValue(Unknown Source)
at com.servoy.j2db.dataprocessing.az.commitEdit(Unknown Source)
at com.servoy.j2db.dataui.EditProvider.itemStateChanged(Unknown Source)
at com.servoy.j2db.dataui.DataComboBox.itemStateChanged(Unknown Source)
at javax.swing.JComboBox.fireItemStateChanged(Unknown Source)
at javax.swing.JComboBox.selectedItemChanged(Unknown Source)
at javax.swing.JComboBox.contentsChanged(Unknown Source)
at javax.swing.AbstractListModel.fireContentsChanged(Unknown Source)
at com.servoy.j2db.util.u.setSelectedItem(Unknown Source)
at com.servoy.j2db.util.u$a.contentsChanged(Unknown Source)
at javax.swing.AbstractListModel.fireContentsChanged(Unknown Source)
at com.servoy.j2db.dataprocessing.n.if(Unknown Source)
at com.servoy.j2db.dataprocessing.n.a(Unknown Source)
at com.servoy.j2db.scripting.JSApplication.js_setValueListItems(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:334)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.executeFunction(Unknown Source)
at com.servoy.j2db.FormController.a(Unknown Source)
at com.servoy.j2db.FormController.executeFunction(Unknown Source)
at com.servoy.j2db.FormController$a.a(Unknown Source)
at com.servoy.j2db.dataui.AbstractScriptLabel.a(Unknown Source)
at com.servoy.j2db.dataui.AbstractScriptLabel.access$800(Unknown Source)
at com.servoy.j2db.dataui.AbstractScriptLabel$5.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI$Handler.repostEvent(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

  1. Does this happen all the time or maybe only the first time?
    this only happen application.setValueListItems is fire b4 application.ShowFormInDialog.
    If the dialog is open already, the method application.setValueListItems does not give any problem.

  2. Could it be that your real values are of the wrong data type?
    I couldnt sure for that.

  3. What data type are your real values and what type is the column?
    My real value data type I want is TEXT. but servoy report it is INTERGER data type for my real value valuelist.
    example, may valuelist
    var A = new Array();
    A[0] = “(All)”
    A[1] = “-”
    for (var i = 2; i <200; i++)
    A = “i”;
    my column data type is TEXT.
    Michael Mooney, I do not have such error if the form is open in a dialog already.
    the input validation error is shown and valuelist is render correctly.
    Thanks.

  1. Does this happen all the time or maybe only the first time?
    this only happen application.setValueListItems is fire b4 application.ShowFormInDialog.
    If the dialog is open already, the method application.setValueListItems does not give any problem.

OK, Why don’t you try first to show your dialog and, in your onShowForm event set the valuelist…

  1. Could it be that your real values are of the wrong data type?
    I couldnt sure for that.

You should be, it could be the cause of issues.

  1. What data type are your real values and what type is the column?
    My real value data type I want is TEXT. but servoy report it is INTERGER data type for my real value valuelist.

Huh, is you column integer and valuelist values text? That will cause issues…