Clearing html area field

Hi,

I have a html area display field on the form. When I clear this field the source code is not cleared causing unknown problems like adding extra html codes or head values etc..

Could you please clear the source when the data is cleared

Thanks

Hai Ahmad,

What I can’t see in your picture is if there is anything between your tags.

Some questions:

  1. I assume you let your user clear the field? Or is this done through scripting?
  2. Why are you talking about adding extra html? Again, when the user adds stuff himself this should happen in the body. When you do it programmatically this can be avoided.

Solution:
What you can do is check for content between the body tags with a regular expression. Trim it and remove
tags etc, to be sure it is empty. When empty make the field null…

Hope this is what you were looking for…

IT2BE:
Solution:
What you can do is check for content between the body tags with a regular expression. Trim it and remove
tags etc, to be sure it is empty. When empty make the field null…

Hope this is what you were looking for…

Thanks it2be for your kind help.

Actually the user some times copy & paste from web content into html area which adds lot of rubbish stuff like tags within head, styles, javascript functions etc.. which actually does not matter

But when the user completely clears the html area field, the data is not cleared in background means when I display the same field in a text area I could see there are still unwanted html tags found in the field.

Even though this is not a problem within Servoy display, the reason I want them cleared is because when it goes to web, when I check whether the field is empty for some coding purpose it gives me wrong result (it says the field is not empty even though it was cleared in the html area within Servoy)

Anyway, if this can be fixed some how by Servoy that would be great, otherwise I would need to go for your regexp idea though I still donno how to do

Thanks

To completely remove html tags, place a button that says “clear html”
and let it do a script> myHtmlField = null