Announcement

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

    DynamicForm -> null -> HTTP parameter

    Dear SmartGWT users,
    please help me. I have DynamicForm with field which represents not nullable database column.
    When I do not fill this field with any value and saving form data there is not any error displayed. This happens because server request contains something like:

    Code:
    &description=null&
    and on the server side I am not able to resolve whether description is set to null value or to 'null' value. It is considered as string and saved to database as 'null' value. Any ideas how to solve this problem?

    Best regards,

    Ales

    #2
    My workaround of the mentioned problem was to override method DataSource.transformRequest(DSRequest request) by the following way:

    Code:
    	protected Object transformRequest(DSRequest request) {
    		JavaScriptObject jso = request.getData();
    		for (String fieldName : getFieldNames()) {
    			if (JSOHelper.getAttributeAsObject(jso, fieldName) == null) {
    				JSOHelper.deleteAttribute(jso, fieldName);
    			}
    		}
    
    		return jso;
    	}
    Method getFieldNames() is not a part of the SmartGWT API. It is my own method which returns all names of the fields set for data source.

    Best regards,

    Ales

    Comment

    Working...
    X