Hello all,
I have a situation regarding servoy validatoin for fields marked as not “Allow Null”.
I have a form based on a table. the two fields on the form are not nullable. One is a drop down, the other is a text field
a) if we don’t set any values and click a button to “Save” the data, we can trap the error and display our own error message to the user.
b) if we set the drop down value and leave the text value untouched we can trap the error and display our own error message to the user
c) if we delete the text value and leave the drop down value we can trap the error and display our own error message to the user
here’s were it gets weird.
- set both values.
- set the drop down to an empty value.
the drop down goes red
- Click ok, nothing happens. The form appears locked.
the server log shows:
Error Handler (Non-Oracle error): Invalid input, Validation failed for ‘field_name’, with value: null User: user@0:0:0:0:0:0:0:1 Form: Element: Servoy Error Code: 310
- now set the drop down to a value and clear the text
- try to click okay, the text field retains focus and similar error is displayed in relation to this field value.
I can see that servoy is trying to handle this issue, problem is the user has no idea whats happening behind the scenes as our dialog won’t be displayed anymore.
Could someone explain what might be going on? and how do I get around this issue?
Thanks
Servoy Version: 5.2.7 - build 1013
Windows XP/7
Firefox Version 3.6.16
Click ok, nothing happens. The form appears locked.
the server log shows:
Error Handler (Non-Oracle error): Invalid input, Validation failed for ‘field_name’, with value: null User: user@0:0:0:0:0:0:0:1 Form: Element: Servoy Error Code: 310
but this is a servoy exception (the null check) that calls your solution.onError method…
Are you saying that that method is not called? in this situation?
Hi Johan,
The solutions solution.onError method is being fired in this situation.
The issue here is that our own error handling is not being called after the servoy exception has been fired.
I tried to incorporate the code from the example but the servoy exception stops the user from being able to close a new modal window.
if (ex instanceof ServoyException)
{
switch (ex.getErrorCode())
{
case ServoyException.SAVE_FAILED:
case ServoyException.INVALID_INPUT:
forms.graphics_template_dialog.setup_dialog(null, 'Error Handler', 'It seems you did not fill in a required field', 'Ok');
return ;
default:
return;
}
}
Is there any way to get around that? or is there a way to stop servoy exception handling in certain cases? we have our own error handling that would prevent a user from proceeding until they have passed our validation.
Ernest,
i don’t see the complete picture here, when is your code being called? What is the trigger?
That code is behind the button?
So you really don’t want servoy to do the null validation?
that you can configure:
databaseManager.setNullColumnValidatorEnabled(false)
Johan,
Our code is being called on the onAction trigger of a button when a user clicks okay to close the dialog.
After the button is clicked we call a “PreCheck” function to validate the data is complete / valid. In this case we verify that both “not nullable” fields are set before allowing the user to continue.
Some scenarios on the form with two fields are
a) if we don’t set any values and click the “Save” button the data, we can trap the error and display our own error message to the user.
b) if we set the drop down value and leave the text value untouched, and click the “Save” button, we can trap the error and display our own error message to the user
c) if we delete the text value and leave the drop down value, and click the “Save button”, we can trap the error and display our own error message to the user
One of the issues it that the built in null validation doesn’t execute in all instances and only occurs after a value has been set and then removed.
I can try to remove validation and then reapply it after the form closes.
eKelman:
One of the issues it that the built in null validation doesn’t execute in all instances and only occurs after a value has been set and then removed.
and that’s on purpose.
A user shouldnt get error messages or something if he just tabs over the field besides that, the null check is only done when the user changes data.
So when a null is tried to be set, and that is never the case if the user does nothing with the field.
So yes those validation should be done another time (for example your button click or table events)
Johan,
is there any way to get feedback to the user regarding items that need to be filled in?
do you know of a css value that we could set to make it more visible to the user?
Modifying the solutions onError method fails for us because the user is not able to close the new dialog window opened from the solutions on error method (via a button action). It can be closed if the user clicks the “X” twice.
Ernest
why don’t you use the databaseManager.setNullColumnValidatorEnabled(false) ?
then you can do it all in your method and we don’t do it.