• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 19. Creating Custom Tags > Attribute Validation and Error Handling

19.5. Attribute Validation and Error Handling

In the previous section, we touched briefly on the idea of attribute validation when we used the IsDefined( ) function to check for the existence of an attribute before allowing processing within the custom tag to continue. This section takes things a step further by demonstrating various techniques you can use to create both required and optional attributes for your tags. Additionally, we'll look at error- and exception-handling strategies you can use to deal with problems that occur in your custom tags.

19.5.1. Handling Required Attributes

Depending on the type of custom tag you create, you may want or need to require certain attributes to be passed in order for the tag to do its job. Making a tag attribute required is as simple as using a CFIF statement inside the custom tag to evaluate whether the tag exists. This is usually handled by the IsDefined function:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint