Problem with setting htmlText of field to empty in LiveCode 6.6 RC2

J. Landman Gay jacque at hyperactivesw.com
Wed Mar 19 11:45:56 EDT 2014


On 3/19/14, 9:35 AM, Mark Schonewille wrote:
> In the past 15 years I never had any problems with htmlText always
> containing p tags, even if the text of the field was empty.
> Therefore, I think it is no bug.

I haven't had any problem with it either, but that doesn't mean it isn't 
a bug. Consider this, which is very similar to what my current project does:

A user enters some styled text into a field. The text is stored as 
htmltext in a custom property.

Because the field is a background field, there may be many of these 
properties per field, and the correct text is displayed based on the 
stack's current status. In my project, a preOpenCard handler looks for 
the correct property to determine which text to display.

In some cases the script needs to determine whether the custom property 
has content or not in order to take action. Because the text in the 
field may not be the text that needs to be checked, the custom property 
is checked.

If it contains paragraph tags, it isn't empty and the script fails. (In 
my case this doesn't matter; in other cases it could.)

I anticipate you will say "don't put anything in the custom property if 
you plan to check it" -- but if the content is set by the user then we 
have no control over that. And I agree -- if there is no content, then 
the engine should not put anything into the custom property.

It isn't difficult to script around the behavior but I think it 
shouldn't happen in the first place. And it does defy the definition of 
"empty."

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




More information about the use-livecode mailing list