Skip to: Main Content Search Main Navigation Audience Navigation

Ohio University is OPEN.

OHIO IS HERE TO HELP: Any students, faculty or staff affected by the Carriage Hill Apartments fire ... More Information

V8 -- Using the HTML Fragment Element

Because of interactions between the form tags and the scripting used to achieve the Rich Text Editor on the one hand, and the code you might write on the other hand, it is not reliable to use the HTML view of a Formatted Text Block to construct forms or to place scripting content into a page.

Instead, use the "HTML" element, as described here. That will let you upload an HTML fragment file (use files that include only HTML sections that are between the <BODY> and </BODY> tags, not including those tags) from your personal computer's disk drive. You can prepare that file however you want. In addition to form and script code, you can also use the HTML element to place browser-side IMAGEMAP data into a page or template.

We suggest that you not use the "Copy element" and "Paste Element" features of CommonSpot to replicate an HTML fragment element from one page to another (it is OK within a page). In the past, there was a bug in CommonSpot, such that if, at some later time, the original page were deleted, the HTML fragment file was also deleted, and the page into which it had been pasted was irretrievably broken. This bug appears to have been fixed in the current version, but why take the chance that it will re-appear? Instead, just place a new HTML fragment element into the second page, and re-upload the file.

If you prepare your HTML fragment file on a Windows PC using Wordpad, be sure that you save the file in "Text Document" format, not in "Rich Text Format (RTF)" -- the latter will not work, and will, among other nastiness, generate content with lots of spurious, visible back-slash characters ("\"). When saving a new HTML file from Wordpad, enclose the filename in quotes (e.g., "fragment.html") so that it will not silently add ".txt" at the end of the name that you provide.

The following steps describe the techniques for working with HTML fragment elements:

  1. Click on the phantom link, "Click to insert new element."

  2. Click to expand the "Word, HTML & Other Format Elements" category of the Element Gallery.

  3. Click on the "HTML" element.

  4. Observe at that place in your page the phantom link, "Click here to define the HTML element".

  5. Click there.

  6. Click on the "Browse" button and choose your HTML fragment file. 

  7. Click on the "Upload" button. Your HTML will be embedded into the page. Observe the yellow work-in-progress icons; submit the page for publication when appropriate.

  8. If you are in Author or Edit mode after embedding the HTML fragment, and click on the Element Properties "gear wheel" icon (), you will be given two initial choices for updating that part of your page:

    • Upload Content:   gives you the chance to Browse your computer for a replacement file that you have already prepared, just as you did when first defining the element.

    • Edit:   gives you three secondary choices:

      • Edit Online: this will give you a variation on the Rich Text Editor; in general, we advise against taking this choice, at least in most of the cases where we expect people to be using the HTML element. Absolutely do not use this choice if your HTML contains any FORM components or inline Javascript -- they almost always collide destructively with the behind-the-scenes implementation of the Rich Text Editor. Further, changes made by this method will be lost if you use the third method, below.

      • Upload Updated Changes: you will take this choice if you have already edited the fragment file, so that you have an updated file in place, waiting to upload. You will be taken through the same browse... dialog as before. This is the preferred approach for any HTML fragment that contains FORM components (e.g., custom searches or MAILER code) or inline Javascript. Equivalent to "Upload Content."

      • Open Last Uploaded Version: CommonSpot will download the file you previously uploaded (therefore, not including changes made in prior sessions that used the Rich Text Editor), so that you can edit it on the computer you are currently using. Then you will upload it again to replace the prior version.