Hello.
DataSource definition
REST POST request
In myTable I have a single column defined to take maximum 3 characters.
All works well in the UI, because the FormItem I create related to the datasource field myField will accept only 3 characters at maximum.
The problem is that if I send a REST request targeting that datasource, I will end up with an ugly DB exception, since I cannot store in the column more than 3 characters.
To make sure this does not happen I need to change my field definition in the DS to
The question is, couldn't smartgwt have such implicit validator when defining the length of the field?
DataSource definition
Code:
<DataSource ID="myDS" serverType="sql" tableName="myTable">
<fields>
<field name="myField" type="text" length="3"/>
</fields>
</DataSource>
Code:
{
dataSource:"myDS",
operationType:"add",
data:{
myField: "abcd"
}
}
All works well in the UI, because the FormItem I create related to the datasource field myField will accept only 3 characters at maximum.
The problem is that if I send a REST request targeting that datasource, I will end up with an ugly DB exception, since I cannot store in the column more than 3 characters.
To make sure this does not happen I need to change my field definition in the DS to
Code:
<DataSource ID="myDS" serverType="sql" tableName="myTable">
<fields>
<field name="myField" type="text" length="3">
<validators>
<validator type="lengthRange" max="3"/>
</validators>
</field>
</fields>
</DataSource>
Comment