HOw to get htmltext from the field to display in another field

J. Landman Gay jacque at hyperactivesw.com
Sun Sep 20 16:10:40 EDT 2020


On 9/20/20 9:28 AM, Sannyasin Brahmanathaswami via use-livecode wrote:
> Eureka! So easy, now to get back to the htmlText as per the code
> 
> if the htmlText of field "mainText"  then
>        put the htmlText of field "mainText" into field "mainText"
>     else
>        set the htmlText of field "mainText" to field "mainText"
>    end if
> 
> we wonder how easy it to tell that "if" the clause is telling it is "true"
> 
>   if (set the htmlText of field "mainText" to field "mainText") then
> 
> does not work

Typically you can check the field text for a known html entity to see if it contains html or 
not. I think LC uses "<p>" because almost all html includes a paragraph mark.

if "<p>" is in field "mainText" then -- htmltext is there

If your html doesn't have paragraph entities then see if you can find one that you know will be 
there.

As an aside, I first thought that this would work:

   if the htmltext of field "mainText" <> the text of field "mainText" then -- plain text is in 
the field

which does return "false" correctly. But when I set the text of the field to the htmltext of 
the field and run the same test, it also returns "false". I'm not sure why.


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list