Token: TextEditor

By Kevin Schreiner

December 19, 2008

The "Texteditor" token is used to support Rich Text fields within a form.  The token works well with both AJAX and Non-AJAX interaction, although on some platforms (like DotNetNuke) a little bit of extra know-how is necessary to retrieve the data when used through an AJAX postback. Refer to the AJAX postback notes at the bottom of this article.



When is this useful?


When you want to provide a fully Rich Text enabled form element. This is useful when your form must have a large amount of text, and other material like images and html syntax.

Syntax


Syntax
{TEXTEDITOR,id,source name,variable type,width,height}

Example
{TEXTEDITOR,frmContent,Content,,100%,400}

The output of that particular entry will look something like this:

 In the above example, the Variable Type is left blank. That is because the variable source is the Query Template itself, so we are pulling the Content Column. When the page is posted back to the server, the variable "frmContent" from the Form contains the rich text in HTML format. Just like every other form variable.

The Width and Height parameters control the size of the textbox. You may use percent or full values. Do not end the value with "px" which is often tempting as it will result in a unknown size.

Note: WHEN USING RICH TEXT IN AJAX MODE - if you are posting back the form by using "ows.Fetch", you must be aware of the element and its handling. In DotNetNuke the Rich environment is NOT smart enough to know that the form is about to be sent back to the server. Their textbox grabs ONLY the content from the box when the Submit is detected. Without this event, the value will be returned blank. To force the page to get the value PRIOR to the postback, you must execute a small line of javascript. Again, using the previous example as our Textbox within DotNetNuke:

document.getElementById('frmContent').value=FCKeditorAPI.GetInstance('frmContent').GetXHTML(true);

That should be called just prior to the ows.Fetch request.

Average (1 Ratings):
 
Want to help out?
 
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • info@openwebstudio.com

Bookmark & Share Bookmark and Share