Creating A Dynamic Feedback Box

Using JavaScript - we can create our own custom feedback box and set the information the way we desire depending on the context. The nice thing is that I can reuse this same box and simply change the information and eliminate the need to create multiple boxes with custom messages. In this tutorial, I will walk you through how we can accomplish this.

1. Create your custom feedback layer.

Select View >> Feedback Master

Select Insert Layer and select the newly created layer so it is highlighted.
Be sure to place a check in the box for Text in the placeholders section in the ribbon. Color and style the layer as you desire.

We have a few things to do here…

You will want to rename the objects for your feedback layer so you can easily refer to them later.

I chose to name the Title Box as feedbackTitle
I chose to name the Message Box as feedbackMsg
I chose to name the Button as feedbackBtn

image

Set an onClick action for the button to Hide the Feedback Layer. You may change the text on the button at this time as well if you so desire. I set mine to OK

image

image

Finally, change the name of your feedback layer as desired by clicking Rename.
For this example, I am changing the name to myFeedback

Close the Master View.

image

3. Create an event that will call the feedback

Your event can be whatever it needs to be in order to fit your project.
For this example I am just making a button with the JavaScript code.

Create a shape on the stage to serve as your button and create an onClick action to Execute JavaScript.

Here is the code you will place in the JavaScript editor.
Notice that I am showing the feedback box first before setting the text.
Sometimes the order of things matters.

// Display the Feedback Box
prez.showFeedbackByName("myFeedback");

// Set the Title Text
prez.object("feedbackTitle").text(
    "Congratulations!"
);

// Set the Message Text
prez.object("feedbackMsg").text(
    "You have successfully created a customizable feedback box that you can easily modify!"
);

You would just need to change the title and message to match your project needs.

Now when the learner clicks my button - the feedback will show. This can be a great way to alert the learner to something important in your course.

image

Hopefully this will help someone or provide some ideas for a project.

4 Likes

Good morning Greg,

We truly appreciate your idea and contribution to our community!
Thank you for sharing your idea with a detailed description. :100: :100:
This may help other community members a lot, I believe.

BR,

1 Like