Announcement

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

    FileItem validation and incomplete ISCFIleItem issue on SmartGWT 12.1p + Internet Explorer 11

    Hello Isomorphic,

    We have been using SmartGWT power in our product for years.
    We are currently evaluating version 12.1p and noticed an issue with FileItem on Internet Explorer 11.
    (SmartClient Version: v12.1p_2021-07-03/PowerEdition Deployment (built 2021-07-03))

    Here is the actual UI operation recording. (i.e. reproduction steps)

    1. Show a form with a file item and a submit button. (the file item is required, and the submit button validates the form and submits the file data to server-side data source if the validation is successful. See the sample code below for details.)
    2. Presses the submit button before specifying a file. -> The form validation fails. (OK)
    3. Specifies a file, then deletes the file. (by selecting the file name text and press the delete key)
    4. Presses the submit button again. -> The form validation succeeds. (NOT OK. The validation should fail here because the file selection is already deleted on the step 3.)

    Click image for larger version  Name:	fileitem-ie-clear-issue-animation-small.gif Views:	19 Size:	61.2 KB ID:	265899

    In addition, the step 4 sends the DSRequest to the server-side data source, but its ISCFileItem becomes incomplete.

    - The file information becomes null ( such as getName() / getFileName() / getShortFileName() )
    - The file content becomes NOT null ( such as getContentType() / getSize() / getInputStream() )

    I think that this behavior is inconsistent and confusing for end users.
    It would be better that the form validation fails on step 4 as same as step 2.
    It will prevent the incomplete ISCFIleItem being sent to server-side data source.

    Could you check if this is a SmartGWT bug?
    FYI: SmartClient Version: v10.1p_2016-08-05/PowerEdition Deployment (built 2016-08-05) works fine with the same scenario.

    Thank you!

    === Sample code below ===

    UI
    Code:
    final DynamicForm dynamicForm = new DynamicForm();
    dynamicForm.setDataSource( DataSource.get( "file_upload_ds" ) );
    
    final FileItem file = new FileItem( "file", "File" );
    file.setRequired( true );
    
    final ButtonItem submitButton = new ButtonItem( "submit", "Upload" );
    submitButton.addClickHandler( new ClickHandler() {
    
        @Override
        public void onClick( final ClickEvent event ) {
    
            if ( dynamicForm.validate() ) {
                dynamicForm.saveData();
            }
        }
    } );
    
    dynamicForm.setItems( file, submitButton );
    
    this.addMember( dynamicForm );
    Data Source XML
    Code:
    <DataSource ID="file_upload_ds"
    dataFormat="iscServer"
    serverType="sql"
    serverConstructor="com.ricoh.mdm.cm.admintool.ris.server.datasource.df.FileUploadDS"
    >
        <fields>
            <field name="pk" type="sequence" hidden="true" primaryKey="true"/>
            <field name="file" type="binary"/>
        </fields>
        <operationBindings>
            <operationBinding operationType="add" allowMultiUpdate="true" operationGroup="Public" >
            </operationBinding>
        </operationBindings>
    </DataSource>
    Data Souce Code
    Code:
    public DSResponse execute( DSRequest req ) throws Exception {
    
        final DSResponse response = new DSResponse();
        final String operation = req.getOperationType();
    
        if ( DataSource.OP_ADD.equals( operation ) ) {
    
            @SuppressWarnings( "unchecked" )
            final ArrayList< ISCFileItem > fileList = (ArrayList< ISCFileItem >)req.getUploadedFiles();
            for ( ISCFileItem fileItem : fileList ) {
    
                logger.info( "#%$#$%#%$##%$#$%#%$##%$#$%#%$# ISCFileItem start" );
                logger.info( "#%$#$%#%$# ISCFileItem getFieldName: " + fileItem.getFieldName() );
                logger.info( "#%$#$%#%$# ISCFileItem getName: " + fileItem.getName() );
                logger.info( "#%$#$%#%$# ISCFileItem getFileName: " + fileItem.getFileName() );
                logger.info( "#%$#$%#%$# ISCFileItem getShortFileName: " + fileItem.getShortFileName() );
                logger.info( "#%$#$%#%$# ISCFileItem getContentType: " + fileItem.getContentType() );
                logger.info( "#%$#$%#%$# ISCFileItem getSize: " + fileItem.getSize() );
                logger.info( "#%$#$%#%$# ISCFileItem getInputStream: " + fileItem.getInputStream() );
                logger.info( "#%$#$%#%$##%$#$%#%$##%$#$%#%$# ISCFileItem end" );
            }
        }
    
        return response;
    }
    Last edited by yohtaka; 18 Jul 2021, 16:04. Reason: 2021-07-19 Added the information that SGWT 10.1p works with the same scenario.
Working...
X