xf:textarea, mediatype=text/html and appearance

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

xf:textarea, mediatype=text/html and appearance

bwallis42
If I create a textarea with a mediatype of text/html and an appearance of character-counter then the textarea doesn't render/work as a rich text area but does have the character-counter. If I then remove the appearance then it does render as a rich text area but without the character-counter (of course).

If instead I use fr-tinymce instead of the textarea with a mediatype then I can get both rich text and the character counter.

This is a problem for us as we have a large number of existing form templates that are using xf:textarea with the mediatype attribute and I need to add an appearance attribute to these to enable a spellchecker xbl control that I have developed. Adding my spellchecker appearance causes the same behaviour as above.

I'm hoping this can be fixed before 2017.1 is released or else I am going to have to convert all my xf:textarea usages that have the mediatype on them to fr:tinymce components. I can do this but I would rather not if possible.

There is an example of this behaviour on demo.orbeon.com in the form type cpf/formrich. The labels describe each of the three components on that test form.

thanks
brian...

Reply | Threaded
Open this post in threaded view
|

Re: xf:textarea, mediatype=text/html and appearance

Alessandro  Vernet
Administrator
Hi Brian,

Good catch. I guess we never tried this, but the fix is ultra-simple, and just consists in copying, in `character-counter.xbl`, the `mediatype` attribute (just like we copy appearances other than `character-counter`). And for reference, this will be in 2017.1:

https://github.com/orbeon/orbeon-forms/issues/3192

You'll let us know if this works for you,

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: xf:textarea, mediatype=text/html and appearance

bwallis42
Thanks for that fix Alex, I've just applied the same change to my spellchecker control and it is working with the mediatype=text/html as well.

That was nice and simple. Do you need to do something similar to the text auto resize control (does that work with a rich text area?)

brian...
Reply | Threaded
Open this post in threaded view
|

Re: xf:textarea, mediatype=text/html and appearance

Alessandro  Vernet
Administrator
Hi Brian,

I'm glad it worked for you. What are you referring to by "the text auto resize control"? To make the character counter work with the Formatted Text Area, I just had to also copy the `mediatype` attribute, but I imagine you've seen that already.

https://github.com/orbeon/orbeon-forms/commit/d099eb8362482234ecf8b8882ab6ca2870c155cf

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: xf:textarea, mediatype=text/html and appearance

bwallis42
I meant the 'With Resizing' appearance on the plain text area (appearance="xxf:autosize")but I see that it is not applicable to the rich text area.

It is a pity those are all radio buttons in the configuration screen since you can apply multiple appearances to the control. autosize, charactercount and my spellchecker all work together on the one control but I have to edit the source to enable this.

thanks
brian...
Reply | Threaded
Open this post in threaded view
|

Re: xf:textarea, mediatype=text/html and appearance

Alessandro  Vernet
Administrator
Hi Brian,

Even if we expected to have more problems with having multiple appearances on the same control, each mapped to a different XLB, the fact that it works in practice is a strong argument for using checkboxes ;). We'll discuss it here, and will follow-up on this thread.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: xf:textarea, mediatype=text/html and appearance

Alessandro  Vernet
Administrator
Hi Brian,

Here is the problem: some appearances aren't exclusive, like having character counter and the resizing, while others are exclusive, like a dropdown and radio buttons. Right now, Form Builder doesn't know what appearance can be used with what other appearances, and thus doesn't let you add multiple appearance. Until we have that mechanism in place, the current behavior seems to be the safe thing to do. And of course, this doesn't prevent you from changing the source of the source to have multiple appearances you know to be compatible.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet