2

I want to create own widget that will be able to interpret the text between start and end tag, eg:

<p1:Btn ui:field="open" >Open</p1:Btn>

Now the UI binder throws error:

Unexpected text in element: "Open" Element <p1:Btn ui:field='open'> (:44)

I supose that the widget have to be somehow marked to allow elements inside. The second thing is how read the element between tags.

1 Answer 1

4

Your widget needs simply implement the HasText interface.

Sign up to request clarification or add additional context in comments.

1 Comment

Or HasHTML if your widget accepts HTML: <p1:Btn>Open <i>this</i>!</p1:Btn>. Beware that setText can receive a < or & that will have to be HTML-escaped if you use the value as HTML (have a look at SafeHtmlUtils to build your widget's content); e.g. <p1:Btn>&lt;Open&gt;</p1:Btn> will pass "<Open>" to setText if the widget is HasText, it'll however give "&lt;Open&gt;" to setHTML if it implements HasHTML.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.