Announcement

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

    Overriding DynamicForm submit

    v8.3d_2012-11-19/PowerEdition Deployment (built 2012-11-19)

    I'm trying to implement a simple search form, which performs ListGrid.filterData() on submit.

    I've extended DynamicForm

    Code:
    public class FilterForm extends DynamicForm
    {
        public FilterForm()
        {
            setHiliteRequiredFields(false);
            setSaveOnEnter(true);
            setDisableValidation(true);
        }
    
    ...
    }
    Code:
    FilterForm form = new FilterForm();
    form.setDataSource(DataSource.get("users"));
    I've overriden all the submit() methods, also in search of the solution - saveData and submitForm methods. None of them are called when i hit enter on the form fields or click on SubmitItem. Instead of that i see validation errors on required fields (while it's setDisableValidation(true)). Removing "required" attributes from datasource helps with validation errors, but still non of the submit methods are called on enter.

    What am i doing wrong?

    log with validation
    Code:
    === 2012-11-22 16:41:56,158 [l0-3] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        values:{
            lastName:"Остап"
        },
        operationConfig:{
            dataSource:"users",
            operationType:"add"
        },
        componentId:"isc_FilterForm_0",
        appID:"builtinApplication",
        operation:"users_add",
        oldValues:{
        },
        criteria:{
        }
    }
    === 2012-11-22 16:41:56,158 [l0-3] INFO  IDACall - Performing 1 operation(s)
    === 2012-11-22 16:41:56,158 [l0-3] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2012-11-22 16:41:56,159 [l0-3] DEBUG DeclarativeSecurity - DataSource users is not in the pre-checked list, processing...
    === 2012-11-22 16:41:56,159 [l0-3] DEBUG AppBase - [builtinApplication.users_add] No userTypes defined, allowing anyone access to all operations for this application
    === 2012-11-22 16:41:56,159 [l0-3] DEBUG AppBase - [builtinApplication.users_add] No public zero-argument method named '_users_add' found, performing generic datasource operation
    === 2012-11-22 16:41:56,160 [l0-3] DEBUG ValidationContext - [builtinApplication.users_add] Adding validation errors at path '/users': {errorMessage=Field is required}
    === 2012-11-22 16:41:56,160 [l0-3] DEBUG ValidationContext - [builtinApplication.users_add] Adding validation errors at path '/users': {errorMessage=Field is required}
    === 2012-11-22 16:41:56,160 [l0-3] DEBUG ValidationContext - [builtinApplication.users_add] Adding validation errors at path '/users': {errorMessage=Field is required}
    === 2012-11-22 16:41:56,160 [l0-3] DEBUG ValidationContext - [builtinApplication.users_add] Adding validation errors at path '/users': {errorMessage=Field is required}
    === 2012-11-22 16:41:56,161 [l0-3] DEBUG ValidationContext - [builtinApplication.users_add] Adding validation errors at path '/users': {errorMessage=Field is required}
    === 2012-11-22 16:41:56,161 [l0-3] DEBUG ValidationContext - [builtinApplication.users_add] Adding validation errors at path '/users': {errorMessage=Field is required}
    === 2012-11-22 16:41:56,161 [l0-3] INFO  Validation - [builtinApplication.users_add] Validation error: [
        {
            password:[
                {
                    errorMessage:"Field is required"
                },
                {
                    errorMessage:"Field is required"
                }
            ],
            login:[
                {
                    errorMessage:"Field is required"
                },
                {
                    errorMessage:"Field is required"
                }
            ],
            department:[
                {
                    errorMessage:"Field is required"
                },
                {
                    errorMessage:"Field is required"
                }
            ]
        }
    ]
    without reqired fields:
    Code:
    === 2012-11-22 16:43:47,162 [l0-7] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        values:{
            lastName:"Остап"
        },
        operationConfig:{
            dataSource:"users",
            operationType:"add"
        },
        componentId:"isc_FilterForm_0",
        appID:"builtinApplication",
        operation:"users_add",
        oldValues:{
        },
        criteria:{
        }
    }
    === 2012-11-22 16:43:47,162 [l0-7] INFO  IDACall - Performing 1 operation(s)
    === 2012-11-22 16:43:47,162 [l0-7] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2012-11-22 16:43:47,165 [l0-7] DEBUG DeclarativeSecurity - DataSource users is not in the pre-checked list, processing...
    === 2012-11-22 16:43:47,165 [l0-7] DEBUG AppBase - [builtinApplication.users_add] No userTypes defined, allowing anyone access to all operations for this application
    === 2012-11-22 16:43:47,165 [l0-7] DEBUG AppBase - [builtinApplication.users_add] No public zero-argument method named '_users_add' found, performing generic datasource operation
    === 2012-11-22 16:43:47,166 [l0-7] INFO  HibernateDataSource - [builtinApplication.users_add] Performing add operation with
    	criteria: {lastName:"Остап"}	values: {lastName:"Остап"}
    === 2012-11-22 16:43:47,170 [l0-7] DEBUG HibernateTransaction - [builtinApplication.users_add] Started new transaction "669513151"
    === 2012-11-22 16:43:47,181 [l0-7] DEBUG SQL - insert into suser (USERBLOCKED, USERDATEBIRTH, DID, USEREMAIL, USERFIRSNAME, USERLASTNAME, USERLOGIN, USERMASKIP, USERPASSWORD, USERPHONE, USERPATRONYMIC) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    === 2012-11-22 16:43:47,197 [l0-7] WARN  JDBCExceptionReporter - SQL Error: 515, SQLState: 23000
    === 2012-11-22 16:43:47,197 [l0-7] ERROR JDBCExceptionReporter - Cannot insert the value NULL into column 'USERLOGIN', table 'SYSTEM.dbo.SUSER'; column does not allow nulls. INSERT fails.
    === 2012-11-22 16:43:47,198 [l0-7] ERROR HibernateDataSource - [builtinApplication.users_add] Failed to save record of type: ru.eurotechnologygroup.etgcrm.server.model.User with values: {
        lastName:"Остап",
        phone:null,
        department:null,
        maskip:null,
        datebirth:null,
        fio:"Остап ",
        password:null,
        id:null,
        email:null,
        secondName:null,
        roles:null,
        blocked:null,
        login:null,
        firstName:null
    } exception: org.hibernate.exception.ConstraintViolationException: could not insert: [ru.eurotechnologygroup.etgcrm.server.model.User]
    I just wanted to override submit and call listGrid.filterData(getValuesAsCriteria()), but submit is never called.

    TY.

    #2
    See SubmitValuesHandler.

    Comment

    Working...
    X