Character Counter and Rich Text

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

Character Counter and Rich Text

bwallis42
The character counter or using an expression to limit the number of
characters in a rich text field gives unexpected results (as far as a user
is concerned) since it counts the HTML markup as well as the user visible
characters.

Is there anyway to avoid this?

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Character Counter and Rich Text

Erik Bruchez
Administrator
Currently not. It's counting "characters including markup", and the rich text
field stores markup as well as plain characters. I am not sure what a
meaningful solution would look like.

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

-Erik

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Character Counter and Rich Text

bwallis42
I think it may require both options, one for the actual number of characters
which is applicable in cases where there are strict storage limits such as
twitter and one for the user's perceived view of the number of characters.

For the second I've tried a constraint expression of

which works OK in the limited set of examples I've tried so far. There is a
saxon function, parse-html(), in the 9.5 PE version that would probably be
better but I don't think that is available in Orbeon (I assume we have the
HE version?)

I would think it would be possible to add something like this to the
character counter as an option as well but I've no idea how to do that.

My concern was for the first case of a limit expression so for the moment my
problem is solved, I'll just need to make sure our customers are aware of
the behaviour of the character counter on rich text fields (and I'm sure
they are not).

thanks.

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Character Counter and Rich Text

bwallis42
This post was updated on .
Seems the constraint expression was missing from the last post so here it is
(I hope). (adn again without the raw tags

string-length(replace(., '</?\w[^<]*>| ', '')) < 15

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Character Counter and Rich Text

Erik Bruchez
Administrator
The expression is still missing for some reason.

Yes Orbeon Forms uses the open source version of Saxon.

I am not entirely convinced that just counting user-visible characters is
very useful in the case where you can have formatting tags which can take
space behind the scene. If that is indeed useful, I agree that there should
be two modes.

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Character Counter and Rich Text

bwallis42
This post was updated on .
In reply to this post by bwallis42
Re-try adding the expression without the raw tags (also edited the post
above) Maybe this will work?

string-length(replace(., '</?\w[^&lt;]*>| ', '')) < 15

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Character Counter and Rich Text

bwallis42
In reply to this post by Erik Bruchez
The use case, as described to me, is to limit the amount of visible text the
user of the form can put in the control, otherwise they tend to write war
and peace in the text box. I think they are trying to get them to start a
new form if the old one gets "full" instead of just keeping adding to it.
The counter would be a good visual indication to the user that they are
getting close to full.

thanks
brian...


--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Character Counter and Rich Text

Erik Bruchez
Administrator
Got it. I think it makes sense.

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].