Actually I've thought a little more about it and I think this construction
is better.
elapsed_time_field("lcm_gt",label=XML(T("LCM %s",(">",)))),
elapsed_time_field("lcm_le",label=XML(T("LCM %s",("≤",)))),
elapsed_time_field("scm_gt",label=XML(T("SCM %s",(">",)))),
elapsed_time_field("scm_le",label=XML(T("SCM %s",("≤",)))),
elapsed_time_field("scy_gt",label=XML(T("SCY %s",(">",)))),
elapsed_time_field("scy_le",label=XML(T("SCY %s",("≤",)))),
-- Joe
On Wednesday, July 26, 2017 at 5:28:01 PM UTC-7, Joe Barnhart wrote:
>
> Hi Anthony --
>
> The problem is that I don't want "LT" but rather "LE", i.e. "less than or
> equal to."
>
> As far as my table comment, I meant that when I used the SQL table and its
> Fields to create an SQLTABLE, the labels "just worked" and produced a
> column header with the desired symbol instead of printing "≤" in the
> column heading. So SQLTABLE behavior differed from SQLFORM in this manner.
>
> I have found a workaround, finally, which lets me have symbols in both
> forms and tables:
>
> elapsed_time_field("lcm_gt",label=CAT(T("LCM"),XML(" >"))),
> elapsed_time_field("lcm_le",label=CAT(T("LCM"),XML(" ≤"))),
> elapsed_time_field("scm_gt",label=CAT(T("SCM"),XML(" >"))),
> elapsed_time_field("scm_le",label=CAT(T("SCM"),XML(" ≤"))),
> elapsed_time_field("scy_gt",label=CAT(T("SCY"),XML(" >"))),
> elapsed_time_field("scy_le",label=CAT(T("SCY"),XML(" ≤"))),
>
> I first tried the obvious, letting T() handle the substitution but again,
> that doesn't work. The &xx; character escapes get printed literally in the
> form label instead of creating the symbol I intended. So I got around the
> problem with CAT(). Still, an awful amount of work and hassle to
> reverse-engineer and make a work around for something that just should have
> worked.
>
> I'm not sure why &xx; is "sanitized" to begin with. It seems like an
> extreme form of sanitizing, to eliminate any and all special characters
> from form labels.
>
> -- Joe
>
> On Wednesday, July 26, 2017 at 5:16:55 PM UTC-7, Anthony wrote:
>>
>> On Wednesday, July 26, 2017 at 7:43:14 PM UTC-4, Joe Barnhart wrote:
>>>
>>> It's even worse than I imagined.
>>>
>>> Leaving off the T() operation, I find that my field labeled "LCM >" is
>>> actually sanitized at some point into:
>>>
>>> <label class="control-label col-sm-5" for="event_join_lcm_gt"
>>> id="event_join_lcm_gt__label">LCM >: </label>
>>>
>>> Yes, something in the process has *recognized* the character ">" and
>>> changed it to ">" But the field "LCM ≤" was sanitized into:
>>>
>>> <label class="control-label col-sm-5" for="event_join_lcm_le"
>>> id="event_join_lcm_le__label">LCM &le;: </label>
>>>
>>> In this case, not only was the ≤ *not recognized* by the sanitizer,
>>> it actually DE-SANITZED it by removing the ampersand and sanitizing it
>>> separately.
>>>
>>
>> Both of the above are encoded as expected -- the ">" character is
>> converted to ">", and the "&" character in "<" is converted to
>> "&". This is consistent and expected behavior. If you want to end up
>> with "<", then why not just start with "<"?
>>
>> What is your ultimate goal? Do you not want the final HTML to include the
>> ">" and "<" HTML entities so they display as ">" and "<" on the page?
>>
>> Also, what do you mean by, "If I use the Field titles directly in a table
>> on my own, they work as expected?" In each case, what do you want to
>> display on the page, and what are you expecting in the raw HTML?
>>
>> Anthony
>>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.