I have a question re. custom validations and the BatchUploader. We are using the latest SmartGWT EE edition, and have a need to upload, validate, and import CSV data.
For the validation part, we have created a custom datasource and overridden the validate() method (calling the super version in that method as well, of course). This has worked nicely when the CSV file is first uploaded, but we have discovered a scenario where it is not working for us.
Basically, some of the custom validations require that two fields be present in combination, call them fields A & B. We then import a CSV for testing with two rows of where A & B are blank in both rows. The batchuploader correctly flags these fields in both rows with the (!).
The first problem is that when the A&B fields are entered manually on the first row, the (!) indicators actually go away on both that row and on the 2nd row as well, even though that 2nd row is still missing the A&B fields. This then enables the import of both rows when the Commit button is selected, which is not the desired result!
The second problem is that the validation of fields A & B on the 2nd blank row can only be triggered when a value is manually entered and then tabbed on one of the fields (onChange, basically). But if the user just keeps the fields blank and tabs through them (not entering a new value), then the validation is NOT triggered, which allows the row to be (erroneously) committed...
I've tried to find a workaround so that the custom validate() would be called as every field is tabbed through (onBlur, basically), but have had no luck so far.
Is there a workaround that you can suggest? Of maybe a fix needed?
Thanks.
For the validation part, we have created a custom datasource and overridden the validate() method (calling the super version in that method as well, of course). This has worked nicely when the CSV file is first uploaded, but we have discovered a scenario where it is not working for us.
Basically, some of the custom validations require that two fields be present in combination, call them fields A & B. We then import a CSV for testing with two rows of where A & B are blank in both rows. The batchuploader correctly flags these fields in both rows with the (!).
The first problem is that when the A&B fields are entered manually on the first row, the (!) indicators actually go away on both that row and on the 2nd row as well, even though that 2nd row is still missing the A&B fields. This then enables the import of both rows when the Commit button is selected, which is not the desired result!
The second problem is that the validation of fields A & B on the 2nd blank row can only be triggered when a value is manually entered and then tabbed on one of the fields (onChange, basically). But if the user just keeps the fields blank and tabs through them (not entering a new value), then the validation is NOT triggered, which allows the row to be (erroneously) committed...
I've tried to find a workaround so that the custom validate() would be called as every field is tabbed through (onBlur, basically), but have had no luck so far.
Is there a workaround that you can suggest? Of maybe a fix needed?
Thanks.
Comment