Announcement

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

    Validate on blur of FormItem

    Hi,
    I would like to validate a form item on blur (when the focus leaves the item). I have tried to do this inside the blur method of the formitem and then call DynamicForm.setFieldErrors to set the error on the form. However, this results in an infinite loop (see below) as the setFieldErrors again results in a blur, it seems.

    Is there an easy/easier/standard way to have validation happen on blur?

    Code:
    anonymous function):1
    isc_FormItem_focusInItemISC_Combined.js:10673
    isc_DateItem_focusInItemISC_Combined.js:11525
    isc_DynamicForm_focusInItemISC_Combined.js:9849
    isc_DynamicForm__focusInItemWithoutHandlerISC_Combined.js:9858
    isc_DynamicForm_showErrorsISC_Combined.js:9810
    isc_DynamicForm_showFieldErrorsISC_Combined.js:9815
    isc_DynamicForm_setFieldErrorsISC_Combined.js:9657
    checkOBDateItemValueob_formitem_widgets.js:384
    blurob_formitem_widgets.js:356
    isc_FormItem_elementBlurISC_Combined.js:10699
    isc_DynamicForm_bubbleItemHandlerISC_Combined.js:9889
    isc_DynamicForm_elementBlurISC_Combined.js:9907
    isc_FormItem__nativeElementBlurISC_Combined.js:10684
    isc_c_Class_invokeSuperISC_Combined.js:274
    isc_c_Class_SuperISC_Combined.js:266
    isc_TextItem__nativeElementBlurISC_Combined.js:11000
    isc_c_FormItem___nativeBlurHandlerISC_Combined.js:10015
    isc_c_FormItem__nativeBlurHandlerISC_Combined.js:10013
    isc_FormItem_blurItemISC_Combined.js:10676
    isc_ContainerItem_blurItemISC_Combined.js:10891
    isc_DynamicForm__blurItemISC_Combined.js:9852
    isc_DynamicForm__focusChangedISC_Combined.js:9868
    isc_c_EventHandler__focusInCanvasISC_Combined.js:1364
    isc_c_EventHandler_focusInCanvasISC_Combined.js:1362
    isc_DynamicForm_elementFocusISC_Combined.js:9905
    isc_FormItem__nativeElementFocusISC_Combined.js:10681
    isc_c_Class_invokeSuperISC_Combined.js:274
    isc_c_Class_SuperISC_Combined.js:266
    isc_TextItem__nativeElementFocusISC_Combined.js:11023
    isc_c_FormItem___nativeFocusHandlerISC_Combined.js:10011
    isc_c_FormItem__nativeFocusHandlerISC_Combined.js:10008
    isc_FormItem_focusInItemISC_Combined.js:10673
    isc_DateItem_focusInItemISC_Combined.js:11525
    isc_DynamicForm_focusInItemISC_Combined.js:9849
    isc_DynamicForm__focusInItemWithoutHandlerISC_Combined.js:9858
    isc_DynamicForm_showErrorsISC_Combined.js:9810
    isc_DynamicForm_showFieldErrorsISC_Combined.js:9815
    isc_DynamicForm_setFieldErrorsISC_Combined.js:9657
    checkOBDateItemValueob_formitem_widgets.js:384
    blurob_formitem_widgets.js:356
    isc_FormItem_elementBlurISC_Combined.js:10699
    isc_DynamicForm_bubbleItemHandlerISC_Combined.js:9889
    isc_DynamicForm_elementBlurISC_Combined.js:9907
    isc_FormItem__nativeElementBlurISC_Combined.js:10684
    isc_c_Class_invokeSuperISC_Combined.js:274
    isc_c_Class_SuperISC_Combined.js:266
    isc_TextItem__nativeElementBlurISC_Combined.js:11000
    isc_c_FormItem___nativeBlurHandlerISC_Combined.js:10015
    isc_c_FormItem__nativeBlurHandlerISC_Combined.js:10013
    isc_FormItem_blurItemISC_Combined.js:10676
    isc_ContainerItem_blurItemISC_Combined.js:10891
    isc_DynamicForm__blurItemISC_Combined.js:9852
    isc_DynamicForm__focusChangedISC_Combined.js:9868
    isc_c_EventHandler__focusInCanvasISC_Combined.js:1364
    isc_c_EventHandler_focusInCanvasISC_Combined.js:1362
    isc_DynamicForm_elementFocusISC_Combined.js:9905
    isc_FormItem__nativeElementFocusISC_Combined.js:10681
    isc_c_Class_invokeSuperISC_Combined.js:274
    isc_c_Class_SuperISC_Combined.js:266
    isc_TextItem__nativeElementFocusISC_Combined.js:11023
    isc_c_FormItem___nativeFocusHandlerISC_Combined.js:10011
    isc_c_FormItem__nativeFocusHandlerISC_Combined.js:10008
    isc_FormItem_focusInItemISC_Combined.js:10673
    isc_DateItem_focusInItemISC_Combined.js:11525
    isc_DynamicForm_focusInItemISC_Combined.js:9849
    isc_DynamicForm__focusInItemWithoutHandlerISC_Combined.js:9858
    isc_DynamicForm_showErrorsISC_Combined.js:9810
    isc_DynamicForm_showFieldErrorsISC_Combined.js:9815
    isc_DynamicForm_setFieldErrorsISC_Combined.js:9657
    checkOBDateItemValueob_formitem_widgets.js:384
    blurob_formitem_widgets.js:356
    isc_FormItem_elementBlurISC_Combined.js:10699
    isc_DynamicForm_bubbleItemHandlerISC_Combined.js:9889
    isc_DynamicForm_elementBlurISC_Combined.js:9907
    isc_FormItem__nativeElementBlurISC_Combined.js:10684
    isc_c_Class_invokeSuperISC_Combined.js:274
    isc_c_Class_SuperISC_Combined.js:266
    isc_TextItem__nativeElementBlurISC_Combined.js:11000
    isc_c_FormItem___nativeBlurHandlerISC_Combined.js:10015
    isc_c_FormItem__nativeBlurHandlerISC_Combined.js:10013
    isc_FormItem_blurItemISC_Combined.js:10676
    isc_ContainerItem_blurItemISC_Combined.js:10891
    isc_DynamicForm__blurItemISC_Combined.js:9852
    isc_DynamicForm__focusChangedISC_Combined.js:9868
    isc_c_EventHandler__focusInCanvasISC_Combined.js:1364
    isc_c_EventHandler_focusInCanvasISC_Combined.js:1362
    isc_DynamicForm_elementFocusISC_Combined.js:9905
    isc_FormItem__nativeElementFocusISC_Combined.js:10681
    isc_c_Class_invokeSuperISC_Combined.js:274
    isc_c_Class_Super

    #2
    Okay, found the solution, instead of directly showing the error I now do this:
    this.form.setError(this.name, errorMsg, false);
    this.form.markForRedraw();

    so pass false in the setError function and then let the form redraw itself.

    gr. Martin

    Comment

    Working...
    X