KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Embedding 4D Tags in other HTML tags
PRODUCT: 4D | VERSION: 6.7 | PLATFORM: Mac & Win
Published On: September 28, 2001

Often times you will want to embed 4D tags inside other HTML tags. For instance:

<input type ="text" name="varName" value = "<!--#4DVAR [Table]Field-->">

This first example is fine, because the 4D tag <!--#4DVAR [Table]Field--> is enclosed in the quote marks. However, the HTML specification says that you cannot embed one HTML tag within another. Therefore, if you wanted to have something like this:

<input type="checkbox" name="cbOne" value="Yes" <!--#4dhtmlvar isChecked-->>

your HTML editor (for example, Dreamweaver or GoLive) may throw up an error or warning message. To get around this problem, try something like this:

<!--#4DIF(isChecked="CHECKED")-->
<input type="checkbox" name="cbOne" value="Yes" CHECKED>
<!--#4DELSE-->
<input type="checkbox" name="cbOne" value="Yes">
<!--#4DENDIF-->