Reputation: 15739
I have an inputTextArea control on my XPage and need to add a Java Converter to run code during the Process Validations phase. I initially used a Validator, but the Validator doesn't run if the value is blank, so I need to use a Converter.
However, I need to reproduce the standard behaviour in the getAsString and getAsObject methods.
The underlying field value could be a multi-value field, in which case the value parameter passed into the Converter has already been changed to a comma-separated string. But it could also be a single text string that happens to include commas. So I can't just do a replace and I can't just output the value as it is. I need to handle the content as the normal converter would.
Any ideas?
Upvotes: 2
Views: 340
Reputation: 370
If I'm following the problem correctly, it's that you may have different input fields that are sometimes multi value and sometimes not on your form. In this instance, my initial instinct is to write a value to the scope and use that value to determine the content and value of your input field. That variable can be checked in your converter to determine the actual content of your field.
Example:
viewScope.put("convMulti_Field1", "false");
Would, in your converter, allow you to check that value, and interpret Field1 as a single-value string.
Hope that's clear!
Upvotes: 0
Reputation: 61
I'm not quite sure if this might a solution. I would guess that the XspInputTextarea class has a default converter. With the method getConverter from the parent parent[...] class javax.faces.component.UIOutput you should get the class.
With the class name you should be able to derive from that class.
But this is just an idea.
Upvotes: 1