O'Reilly logo

Professional Cairngorm™ by Jeremy Wischusen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

19.1. Commenting Overview

The commenting system has the following requirements:

  • Any time the full details of a post are displayed (whether automatically when the application loads, or by user selection) any comments associated with that post should be displayed as well.

  • If there are no comments associated with the current post, the comment list should be hidden.

  • Users may not submit blank comments.

  • Only logged-in users may comment, so the commenting form should be displayed only when there is a user logged in.

  • When the user submits the comment, the submit button should be disabled until a result is returned.

  • When a comment is successfully submitted, the comment form should be cleared and the submit button enabled.

Loading comments when a post is displayed is a matter of triggering the comment loading logic whenever a post is set as the current post.

You can hide the comment display by tying the visibility of the view to the number of comments for the selected posts.

You can keep users from submitting blank comments by using the Flex validation classes that you used for registration and the add posts feature.

You can allow only logged-in users to post comments by tying the visibility of a comment to the user's being logged in.

You can disable the submit button and clear the form by binding a setter function to a property that indicates the status of the comment submission.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required