If I have used Simple Data Binding to bind a field in a data source and I get to see the full value of that field. What I want to do is split that value up and then only show part of it to the user. For instance the field stores the value of a combo box which has "1~Hello" in it and the bind shows me "1~Hello", but I only want to see "Hello". Is there some way like a converter to do this or is the only way via a JavaScript bind with a split("~")[1] on it?
There are many ways to do this. It seems like you are working with a structured list so using a ComboBox, radioButtonGroup or CheckBoxGroup control would allow for definition of an alias in the values. But it you really want a textbox binding, then build a custom converter...
<xp:inputText
id="inputText1"
value="#{viewScope.demo}">
<xp:this.converter>
<xp:customConverter>
<xp:this.getAsObject><![CDATA[#{javascript:
if ("Hello".equals(value)) return "1- Hello";
//do other tests and edits
return value
}]]></xp:this.getAsObject>
<xp:this.getAsString><![CDATA[#{javascript:
if ("1-Hello".equals(value)) return "Hello";
//do other tests and edits
return value
}]]></xp:this.getAsString>
</xp:customConverter>
</xp:this.converter>
</xp:inputText>