Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Trying to create a multi-line dialog box

$
0
0

I have been working on a PDF study guide. At the end of each chapter is a self test, and I have some javascript that scores the exam when a user clicks a button. Currently I am using an app.alert window to advise the user which answers he got correct, and display explanations on the incorrect answers. Unfortunately some of the explanations can be a bit long, so I have had to split some of the longer self exams into multiple alerts. I have a snippet of code (below) as an example of doing a dialog box, but have been unable to find any examples of a multi-line dialog. A couple of thread had responses like "it isn't easy", but no solid examples. Does anyone have an example of a simple, multi-line dialog that I could adapt for my needs?

 

var oDlg = {    description: { name: "Test Dialog", elements: [ { name: "Hello World", type: "static_text", }, { type: "ok", }, ] }
};
// Dialog Activation
app.execDialog(oDlg);

 

 

I attempted to do something like this, but it barfs on the first carriage return:

 

 

 

var sText = "Question 5: Incorrect! The correct answer is B\r\rA, C, and D are incorrect. && and || are both short-circuit operators. With &&, when the left side evaluates to false the right side is never evaluated. And with ||, when the left side evaluates to true, the right side is never evaluated.\r\rIn the first statement, i1 does not equal 99 when it is evaluated, so the second expression is printed. However, it is decremented BEFORE the print statement, so the combined value of i and j is 299.\r\rIn the second statement, the left side of the equation evaluates to false, so the right side is never evaluated. Thus the second expression is printed out.\r\rIn the third statement, i3 equates to 100, so the first expression is printed out.\r\rFor the last statement, the left side of the expression is evaluated to true, so the right is never evaluated. The first expression is printed out.\r\rThe final result is 'Value2: 299, Value2: 300, Value1: 299, Value1: 300'";

var oDlg = {
description: { name: "Test Dialog", elements: [ { name: SText, type: "static_text", }, { type: "ok", }, ] }
};
// Dialog Activation
app.execDialog(oDlg);

 

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>