Back Contents Next

ColdFusion Studio/HomeSite Editing Features for WAP Development

ColdFusion Studio is Allaire's development tool for creating ColdFusion code. If you're confused about the difference between ColdFusion Server and ColdFusion Studio, refer to the opening section of the chapter. ColdFusion Server resides on a web server and serves your CF templates to visiting users. ColdFusion Studio is a development tool used by CF programmers to create CF templates. We've been describing to this point how to use CF Server to serve dynamically generated WML. Now we're going to discuss some features of the Studio editor that have been bolstered to support WML development (dynamic or static).

 

As mentioned in the opening of the chapter, Allaire has based Studio on another product in their line, called HomeSite. Studio adds many features for CF development (a visual database query tool, interactive debugger, and much more), but for the purpose of this section, the features we're discussing are found in either Studio or its less-powerful (and less expensive) cousin.

 

ColdFusion code, like WML, is simply plain text so it can technically be created in any text editor, including lowly NotePad. But Studio/HomeSite is a much more powerful tool for creating ColdFusion code than a simple editor like NotePad. Developed primarily as an HTML editing tool, it has been extended in the recent Release 4.5 revisions to add features for creating WML code.

 

For simplicity, I will refer from now on to just Studio, but unless otherwise specifically stated, the features described apply to HomeSite as well as Studio.

 

Among the features that make ColdFusion Studio so useful for HTML editing are such features as tag attribute insight, tag editors, a tag chooser, tag help and more. Experienced Studio users may notice that tag completion and tag validation features are not mentioned. Unfortunately, testing in 4.51 shows that these features are not yet working for WML tags.

Tag Attribute Insight

Tag insight shows you all the attributes available for a given tag, making it very easy to enter or edit WML tags. When you're typing in a tag, and you press the space bar to enter the first attribute, Studio pops up a list of the available attributes. For instance, consider we are entering a <go> element into our program. As we type in "<go" and then press space to enter the first attribute for that element, if we wait one second, ColdFusion will pop up a list of the valid attributes of the <go>element, such as href and method. This is illustrated in the screenshot on the following page.

 

 

Note that you don't even have to wait for that one-second delay to have the attributes pop up. You can configure Studio to respond more quickly. To set Tag Insight to pop up the choices instantly, use the Studio Options command on the menu and choose the Settings|Tag Insight and then slide the control for delay before displaying tag insight to zero seconds. (The steps are only slightly different in previous releases of Studio.)

 

But the pop up list of tag attributes is not all that's great about this feature. Once you've selected an attribute, Studio then proceeds to pop up a list of the available values for that attribute, if there are any pre-existing ones. So, had we selected the method attribute instead via tag insight, Studio would have popped up in a similar manner the choices post and get, which we could select the same way.

 

This feature isn't reserved only to inserting new tags. It also works when you're editing a tag later. All you need to do is place your cursor within a tag, and enter a space after the tag or an existing attribute/value pair. All the attributes for that tag are shown again for your selection.

 

There are three potential problems to be aware of:

 

q         Studio can't tell that you're coding WML, so if you're entering a tag that has an HTML counterpart (such as <input> or <select>), it will present the attributes for both WML and HTML. Currently there's no way to avoid that problem.

q         The choices offered are not generic, standard WML attributes but are instead based on the Phone.com specification for WML. Therefore, there may be attributes or values offered that are specific to Phone.com browsers and not all WML browsers. (See Appendix A.)

q         Finally, when these attributes are entered by Studio on your behalf, they may be entered in upper case which would be unfortunate, because WML tags/elements as well as their attributes and values must be entered in lowercase. There is a Studio option that controls this, and you need to ensure it's set properly. See the Studio Options command on the menu and choose the Settings option, then from the list of areas to control choose Html, and then turn ON the option listed first, namely lowercase all inserted tags.

 

These challenges are a bit troubling, but the benefits of tag insight far outweigh these minor problems.

 

Tag Editors

Another useful feature built into Studio is the notion of Tag Editors, which is yet another approach allowing you to see the available attributes for a tag. To edit a tag using the tag editor, you can place the cursor on a tag and right-click, choosing Edit tag. You're then shown a dialogue window like this:

 

 

In tag editors with many attributes, a significant benefit is that they show a tabbed interface presenting the most important, commonly used attributes on the first tab's display. Note also that the editor also makes intelligent use of input controls, so true/false options are presented as checkboxes, multiple choice options are presented as drop-downs, and so on. One last thing: those of you who prefer keyboard shortcuts should note that the tag editor can also be called up by clicking on a tag and pressing CTRL-F4.

Tag Chooser

Another great time saver is Studio's Tag Chooser. Accessible anytime using the menu command Tools|Tag Chooser (or the shortcut CTRL-E), this presents a categorized list of tags. It starts out (generally) showing available ColdFusion tags, but you can use the interface to change it to list
WML tags, as shown opposite:


 

 

The display shows all WML tags listed, but if you moved the cursor to one of the categories, such as Task Elements, the list on the right would be reduced to only the tags in that category. Notice also that when you do select a tag from the tag chooser, you're taken to that tag's tag editor (unless it's a very simple tag, in which case it simply enters the tag or tag pair for you).

Tag Help

You can obtain help for any tag – even for WML tags – by pressing the F1 key while the cursor is on a tag (WML, CFML, HTML, or other) or function. To return to the edit mode once the help is displayed, press the Edit tab listed just above the code editing area of the display.

 

Another way to access help is within the Tag Editor feature described above. Though you could easily miss them, there is a pair of "help" buttons in the lower right corner of every tag editor (see the screen shot for the tag editor feature, above). Clicking one of these help buttons will either show the help in an embedded pane of the tag editor window, or it will show the help in an entirely new window.

Tag Completion and Tag Validation

We should mention that Studio also offers a couple of other very useful tag editing features: tag completion and tag validation. With the first, Studio creates a tag's "closing" tag for you when you type the "opening" tag's closing bracket (>). With the second, it validates the entered attributes and values for the given tag (as well as a valid tag) when you enter the closing bracket for a tag.

 

Unfortunately, Studio doesn't currently support either of these features for WML tags. It doesn't close WML tags and the validation capability doesn't recognize them. Even more troublesome, some tags that are valid in both WML and HTML will not be closed – for example entering a <p> tag does not lead to a closing </p> tag being created.

 

Perhaps Allaire will address this in future releases, but for now, just be careful. Also, if you want to, you can add to the list of auto-completed tags, using Options|Settings|Editor|Tag Completion|Add.

 

Another problem with tag completion (when it does work for tags that are valid in both WML and HTML, such as <select>) is that it may create tags in upper case, similar to the problem described earlier. See the section, Tag Attribute Insight, to find out how to correctly set this Studio option.

New Page Wizard

Finally, another useful enhancement in version 4.5 for WML development is the inclusion of a new page wizard for WML files. All this is, really, is a mechanism to create a single, new, untitled WML page within Studio, but it does save you typing all the basic tags that every page should have (the <?xml>, <!DOCTYPE>, <wml>, and <card> tags, and their closing counterparts.)

 

The feature is accessible by choosing File from the command line (Alt-F), then choosing New. A window will open showing the available wizards for HTML development. Click on the WML tab listed at the top right of that dialogue window, to see the two WML wizards:

 

 

By choosing one of these wizards, you'll create a new untitled document with the basic, skeletal tags needed for creating a WML page. The difference between the two is that the "dynamic" page will place the CFCONTENT tag at the top of the page, while the "static" one will not.

 

A word of caution here, however: the WML-oriented new page wizards in Studio create a page using the Phone.com DTD. You can modify this by modifying the file from which it's created, which is in your Studio installation directory (typically Program Files/Allaire/ColdFusion Studio 4.5/Wizards/WML). You can even use Studio to edit the file.

 

There is another reason you may want to tweak the new page wizard. You may remember we mentioned that some WML browsers and gateways complain if there are carriage returns before the initial <?xml> tag. Unfortunately, Studio's "dynamic" new page wizard creates a page not only with the <?xml> tag on its own line but with a blank line between that and the preceding CFCONTENT line. If your testing shows it best to put the CFCONTENT on the same line as the initial <?xml> tag, you can use the approach mentioned above to correct the Studio wizard file(s).


BackContentsNext
©1999 Wrox Press Limited, US and UK.