diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/AddPropertyTypeDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/AddPropertyTypeDialog.java
index 79a87947bf36cc5081b0d26f11aef61fe45d4c01..ce273b205ea753b1fdafb8d64e4812d7fc4414c7 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/AddPropertyTypeDialog.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/AddPropertyTypeDialog.java
@@ -148,7 +148,7 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
     private EntityType entity;
 
     private EntityKind entityKind;
-    
+
     private static final String PREFIX = "property-type-assignment_";
 
     public static final String ID_PREFIX = GenericConstants.ID_PREFIX + PREFIX;
@@ -205,7 +205,7 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
     // Save Property Type on memory
     //
     InMemoryGridAddCallback inMemoryGridCallback;
-    
+
     //
     // Constructor and Init Methods
     //
@@ -217,14 +217,13 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
         this.viewContext = viewContext;
         this.inMemoryGridCallback = inMemoryGridCallback;
         this.entityKind = entityKind;
-        
+
         setWidth(FORM_WIDTH);
         getFormPanel().setFieldWidth(FIELD_WIDTH);
         getFormPanel().setLabelWidth(LABEL_WIDTH);
         loading = new Label(viewContext.getMessage(Dict.LOAD_IN_PROGRESS));
         addField(loading);
-        
-        
+
         this.entity = inMemoryEntityType;
         loadEntityDialog(entityKind, entityCode);
     }
@@ -257,7 +256,7 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
     {
 
         private String code;
-        
+
         AsyncCallbackEntityTypeForDialog(String code)
         {
             this.code = code;
@@ -286,10 +285,11 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
 
     private void entityLoaded(EntityType entity)
     {
-        if(inMemoryGridCallback  == null) { //If is not an in memory grid
+        if (inMemoryGridCallback == null)
+        { // If is not an in memory grid
             this.entity = entity;
         }
-        
+
         removeField(loading);
         // Enable Layout Changes
         getFormPanel().setLayoutOnChange(true);
@@ -340,7 +340,6 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
                     public void handleEvent(BaseEvent be)
                     {
                         setSelect(false == isSelect());
-
                         hidePropertyTypeRelatedFields();
                         hideEntityTypePropertyTypeRelatedFields();
                         getFormPanel().removeAll();
@@ -368,7 +367,8 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
         getPropertyTypeSelectionWidget().enable();
         getPropertyTypeSelectionWidget().setVisible(true);
 
-        if(inMemoryGridCallback == null) {
+        if (inMemoryGridCallback == null)
+        {
             addField(getEntityTypeSelectionWidget());
             getEntityTypeSelectionWidget().disable();
             getEntityTypeSelectionWidget().setVisible(false);
@@ -410,6 +410,7 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
         addField(getVocabularySelectionWidget());
         getVocabularySelectionWidget().clear();
         getVocabularySelectionWidget().setVisible(false);
+
         addField(getMaterialTypeSelectionWidget());
         getMaterialTypeSelectionWidget().clear();
         getMaterialTypeSelectionWidget().setVisible(false);
@@ -426,7 +427,8 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
         getPropertyTypeSelectionWidget().disable();
         getPropertyTypeSelectionWidget().setVisible(false);
 
-        if(inMemoryGridCallback == null) {
+        if (inMemoryGridCallback == null)
+        {
             addField(getEntityTypeSelectionWidget());
             getEntityTypeSelectionWidget().disable();
             getEntityTypeSelectionWidget().setVisible(false);
@@ -459,7 +461,8 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
     @Override
     protected void register(final AsyncCallback<Void> registrationCallback)
     {
-        if(inMemoryGridCallback == null) {
+        if (inMemoryGridCallback == null)
+        {
             if (false == isSelect())
             {
                 final PropertyType propertyType = createPropertyType();
@@ -472,11 +475,12 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
                 viewContext.getService().assignPropertyType(assignment,
                         new AssignPropertyTypeCallback(viewContext, registrationCallback));
             }
-        } else {
+        } else
+        {
             boolean isExixtingPropertyType = isSelect();
             PropertyType propertyType = null;
             NewETPTAssignment assignment = createAssignment();
-            
+
             if (false == isSelect())
             {
                 propertyType = createPropertyType();
@@ -484,7 +488,7 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
             {
                 propertyType = propertyTypeSelectionWidget.tryGetSelectedPropertyType();
             }
-            
+
             inMemoryGridCallback.callback(isExixtingPropertyType, propertyType, assignment);
             this.close();
         }
@@ -517,7 +521,10 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
     private final PropertyType createPropertyType()
     {
         final PropertyType propertyType = new PropertyType();
-        propertyType.setCode(getPropertyTypeCodeField().getValue());
+        if (getPropertyTypeCodeField().getValue() != null)
+        {
+            propertyType.setCode(getPropertyTypeCodeField().getValue().toUpperCase());
+        }
         propertyType.setLabel(getPropertyTypeLabelField().getValue());
         propertyType.setDescription(getPropertyTypeDescriptionField().getValue());
         propertyType.setDataType(getDataTypeSelectionWidget().tryGetSelectedDataType());
@@ -545,13 +552,14 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
 
     private final NewETPTAssignment createAssignment()
     {
-        //This code field can only be assigend here if the entity type exists.    
+        // This code field can only be assigend here if the entity type exists.
         String entityTypeCode = null;
-        if(inMemoryGridCallback == null) {
+        if (inMemoryGridCallback == null)
+        {
             entityTypeCode = ((EntityType) getEntityTypeSelectionWidget().tryGetSelected()).getCode();
         }
-        
-        //This code field comes from a different component depending if the property is being created or just assigned.    
+
+        // This code field comes from a different component depending if the property is being created or just assigned.
         String propertyTypeCode = null;
 
         if (isSelect())
@@ -562,7 +570,6 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
             propertyTypeCode = getPropertyTypeCodeField().getValue().toUpperCase();
         }
 
-        
         NewETPTAssignment newAssignment = new NewETPTAssignment(
                 entityKind,
                 propertyTypeCode,
@@ -863,13 +870,15 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
         }
 
         EntityType entityType = null;
-        
-        if(inMemoryGridCallback == null) {
+
+        if (inMemoryGridCallback == null)
+        {
             entityType = (EntityType) getEntityTypeSelectionWidget().tryGetSelected();
-        } else {
+        } else
+        {
             entityType = entity;
         }
-        
+
         if (propertyType != null && entityType != null && propertyType.getDataType() != null)
         {
             final List<EntityTypePropertyType<?>> etpts = new ArrayList<EntityTypePropertyType<?>>(entityType.getAssignedPropertyTypes());
@@ -1189,13 +1198,13 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
         {
             vocabularySelectionWidget = new VocabularySelectionWidget(viewContext);
             Listener<BaseEvent> vocabularyListener = new Listener<BaseEvent>()
-            {
-                @Override
-                public void handleEvent(BaseEvent be)
                 {
-                    updatePropertyTypeRelatedFields();
-                }
-            };
+                    @Override
+                    public void handleEvent(BaseEvent be)
+                    {
+                        updatePropertyTypeRelatedFields();
+                    }
+                };
             vocabularySelectionWidget.addListener(Events.Change, vocabularyListener);
             FieldUtil.markAsMandatory(vocabularySelectionWidget);
         }
@@ -1206,17 +1215,18 @@ public class AddPropertyTypeDialog extends AbstractRegistrationDialog
     {
         if (materialTypeSelectionWidget == null)
         {
-            materialTypeSelectionWidget = MaterialTypeSelectionWidget.createWithAdditionalOption(viewContext, viewContext.getMessage(Dict.ALLOW_ANY_TYPE), null, ID);
+            materialTypeSelectionWidget =
+                    MaterialTypeSelectionWidget.createWithAdditionalOption(viewContext, viewContext.getMessage(Dict.ALLOW_ANY_TYPE), null, ID);
             Listener<BaseEvent> materialListener = new Listener<BaseEvent>()
+                {
+                    @Override
+                    public void handleEvent(BaseEvent be)
                     {
-                        @Override
-                        public void handleEvent(BaseEvent be)
-                        {
-                            //TO-DO The material type selector widget don't supports to change the selected type after creation.
-                            //Because of that is necessary to force the reload of this fields.
-                            updatePropertyTypeRelatedFields();
-                        }
-                    };
+                        // TO-DO The material type selector widget don't supports to change the selected type after creation.
+                        // Because of that is necessary to force the reload of this fields.
+                        updatePropertyTypeRelatedFields();
+                    }
+                };
             materialTypeSelectionWidget.addListener(Events.Change, materialListener);
             FieldUtil.markAsMandatory(materialTypeSelectionWidget);
         }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/entity_type/NewEntityTypeForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/entity_type/NewEntityTypeForm.java
index 18f9f1edfc12c735f23255a80a98aabf04c132d5..640d460a06f7776dc20ba976fc1177cc465b7b1a 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/entity_type/NewEntityTypeForm.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/entity_type/NewEntityTypeForm.java
@@ -351,7 +351,13 @@ public class NewEntityTypeForm extends ContentPanel
                 SampleType toSaveSample = (SampleType) newTypeWithAssigments.getEntity();
                 toSaveSample.setCode((String) formFields.get(0).getValue());
                 toSaveSample.setDescription((String) formFields.get(1).getValue());
-                toSaveSample.setValidationScript((Script) formFields.get(2).getValue());
+                ScriptChooserField scriptChooserField = (ScriptChooserField) formFields.get(2);
+                if (formFields.get(2).getValue() != null)
+                {
+                    Script script = new Script();
+                    script.setName((String) formFields.get(2).getValue());
+                    toSaveSample.setValidationScript(script);
+                }
                 toSaveSample.setListable((Boolean) formFields.get(3).getValue());
                 toSaveSample.setShowContainer((Boolean) formFields.get(4).getValue());
                 toSaveSample.setShowParents((Boolean) formFields.get(5).getValue());
@@ -365,7 +371,12 @@ public class NewEntityTypeForm extends ContentPanel
                 DataSetType toSaveDataSet = (DataSetType) newTypeWithAssigments.getEntity();
                 toSaveDataSet.setCode((String) formFields.get(0).getValue());
                 toSaveDataSet.setDescription((String) formFields.get(1).getValue());
-                toSaveDataSet.setValidationScript((Script) formFields.get(2).getValue());
+                if (formFields.get(2).getValue() != null)
+                {
+                    Script script = new Script();
+                    script.setName((String) formFields.get(2).getValue());
+                    toSaveDataSet.setValidationScript(script);
+                }
                 toSaveDataSet.setDataSetKind(((DataSetKindSelectionWidget) formFields.get(3)).getValue().getBaseObject());
                 toSaveDataSet.setDeletionDisallow((Boolean) formFields.get(4).getValue());
                 toSaveDataSet.setMainDataSetPattern((String) formFields.get(5).getValue());
@@ -376,14 +387,24 @@ public class NewEntityTypeForm extends ContentPanel
                 ExperimentType toSaveExperiment = (ExperimentType) newTypeWithAssigments.getEntity();
                 toSaveExperiment.setCode((String) formFields.get(0).getValue());
                 toSaveExperiment.setDescription((String) formFields.get(1).getValue());
-                toSaveExperiment.setValidationScript((Script) formFields.get(2).getValue());
+                if (formFields.get(2).getValue() != null)
+                {
+                    Script script = new Script();
+                    script.setName((String) formFields.get(2).getValue());
+                    toSaveExperiment.setValidationScript(script);
+                }
                 newTypeWithAssigments.setEntity(toSaveExperiment);
                 break;
             case MATERIAL:
                 MaterialType toSaveMaterial = (MaterialType) newTypeWithAssigments.getEntity();
                 toSaveMaterial.setCode((String) formFields.get(0).getValue());
                 toSaveMaterial.setDescription((String) formFields.get(1).getValue());
-                toSaveMaterial.setValidationScript((Script) formFields.get(2).getValue());
+                if (formFields.get(2).getValue() != null)
+                {
+                    Script script = new Script();
+                    script.setName((String) formFields.get(2).getValue());
+                    toSaveMaterial.setValidationScript(script);
+                }
                 newTypeWithAssigments.setEntity(toSaveMaterial);
                 break;
         }
@@ -415,7 +436,15 @@ public class NewEntityTypeForm extends ContentPanel
         {
             // In case of success, in case the user reopen it without refreshing to avoid a glitch
             newTypeWithAssigments.updateOrdinalToGridOrder();
-            initForm(true);
+
+            if (entityToEdit == null)
+            {
+                MessageBox.alert("Success", "Registration Successful.", null);
+                initForm(true);
+            } else
+            {
+                MessageBox.alert("Success", "Update Successful.", null);
+            }
         }
     }
 }