Then you need to either implement a folder rule or a behaviour to set the cm:name property to a value concatenated from the values of the two fields. For a behaviour, the OnCreateNode policy might be useful. If you want to keep the name synchronized to the values of the two fields, you may also want to implement the OnUpdateProperties policy.
The rule is applied as part of the transaction (provided you do not explicitly specify to run it "in the background"). So if the rule changes the name to something that conflicts, then the conflict is detected and the transaction is rolled back. No need to delete anything, because rolling back the transaction means everything is undone...
Hello You can achieve this by the combination of behavior (NodeServicePolicies.OnUpdatePropertiesPolicy) and overriding the front end validation while submitting the form (If you are not using java webscript to create folder).
Check this url -
basically, you need to override the "form.post.json.js" file.