Validation Application block - custom validator - message template - enterprise-library

I am using Enterprise Library 4.1 Validation Application Block. I have created a custom validator and overridden the DefaultMessageTemplate property. My DoValidate method logic is as below
LogValidationResult(validationResults, String.Format(DefaultMessageTemplate, currentTarget, key), currentTarget, key)
However, when I specify a custom MessageTemplate for this validator in the Configuration tool, only the DefaultMessageTemplate text is displayed. How do I override the default message with a custom message for custom validators?
I would appreciate any help.
Thanks!

I managed to resolve this issue - it was because of incorrect constructors on the custom validator.
Thanks!

Related

Autofac with string configuration but without Microsoft.Extensions.Configuration

The documentation for Autofac has a section for registering components with XML or JSON but it relies on Microsoft.Extensions.Configuration. Is there a way to do without without loading the string into that extension first?
My environment is based on the latest Xamarin.Forms and Autofac.
Cheers,
Luiz
The config mechanism provided uses that extension. If you don't want Microsoft. Extensions.Configuration then you'll need to roll your own configuration mechanism.

GWT Deferred Binding method call

Is it possible to use GWT deferred binding to make a method invocation of a class?
I've developed a GWT application whereby web pages forms UI widgets are generated using property files instead of coding them in Java.
Using sample property file below, my intention of using Java like reflection in GWT is so that if btnSave is clicked in a form, it will invoke validateAddress() method inside FormValidator.java to perform UI validation on address fields
Sample Property file
txtAddress.UiType=TextField
btnSave.Title=Save
btnSave.UiType=Button
btnSave.onClick=com.sample.form.validation.FormValidator.validateAddress()
FormValidator.java
public boolean validateAddress(){
...(validation code)
}

How do I create AnyPoint Studio connector designer controls?

I am using DevKit to create a component for Anypoint Studio. I would like to create some complex configuration controls on the designer page but I can't figure out how to add those. I don't want the configuration to occur on the popup "Connector Configuration" dialog because that creates a global config and I need each component configured individually. Attached is a picture of the FTP designer page to show clearly what I'm talking about.
What do I need to implement in order to create these controls?
When I want to make properties like that, I make a method in the Connector class and annotate it with the #Processor Annotations e.g
#Processor(friendlyName="delete")
public List<String> deleteFiles(String hostName, String userName, String password, String path, String port){
}
The Downside of this is that you get an operation property in your connector but when you select an operation the params of that operation is shown. And you have to code it so that these are properties is overriding
those of the global configuration
Here is how the above code would look like when you use the connector
Hope this helps
Best regards
Jack

Sails js :: How to add custom validation error

Like Rails is there any way to add custom error message to validator?
Like:
if(this.password != this.passwordConfirmation){
this.errors.add('password', {rule: 'invalid'})
}
You can create custom validations on your models. Or create custom objects and inject them into your models to resusable code. Its actually in the docs!
http://sailsjs.org/#/documentation/concepts/ORM/Validations.html?q=custom-validation-rules
You can create a custom config file for error handling. You can reach that global config object by sails.config.error for example. Advantage of this solution is, that you can access this object in services and other places, where you have no access to the res object.
Next step would be creating a policy which would pass this config error object to res.locals. Or it could be handled in a response file, but I have no experience with that.
Out of the box, Sails.js does not support custom validation messages. But there's a workaround, using hooks.
http://sailsjs.org/documentation/concepts/models-and-orm/validations#?custom-validation-rules
Says the official site.

How can I extend/configure other plone addons preferences Configlets?

I have a third-party addon installed and now I have to extend this Configlet with a boolean Field, how can I do this?
Further I have to use results of a function from this addon?
Thanks in advance.
You can either try
1) Override form via a custom layer registered by your add-on and create new Form class, extending the orignal, which has the same name, but is registered against this layer. Thus, the form class will come from your add-on when your add-on and it's browserlayer is installed.
http://collective-docs.readthedocs.org/en/latest/views/layers.html
Layers are view-specific, so it is the view you are trying to override. Depending on the orignal c.simplesocial architecture it is not sure what kind of view - form relationship is in place.
2) monkey-patch the orignal form class
http://collective-docs.readthedocs.org/en/latest/misc/monkeypatch.html