0

Does Javascript accept nested IF statements coming from Progress 4GL? This piece of code below is placed inside the document ready function, is this acceptable in javascript? When the pdf appears, it shows nothing.. :(

<!--WSS IF get-value('action') = 'print' then DO: -->
<!--WSS IF get-value('action') = 'go' then DO: -->

newPopup("print_preview.html?win=pdf&programname=pdf_sample2.p",1250,1250);

<!--WSS END. -->
<!--WSS ELSE DO: -->

newPopup("print_preview.html?win=pdf&programname=pdf_sample.p",1250,1250);

<!--WSS END. -->
<!--WSS END. -->
Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
user1023
  • 39
  • 1
  • 7

2 Answers2

3

These two lines:

<!--WSS IF get-value('action') = 'print' then DO: -->
<!--WSS IF get-value('action') = 'go' then DO: -->

Implies that the parameter "action" must be both 'print' and 'go' for this line to run:

newPopup("print_preview.html?win=pdf&programname=pdf_sample2.p",1250,1250);

That will of course never happen (action can only have one exact value). If "action" has the value 'print' the second popupscript will be called.

You have to keep in mind what is happening on serverside (everything WebSpeed related) and what happens on clientside (HTML, JavaScript, CSS).

Look at the rendered HTML-code in your browser. Does it look OK? Also: do you get javascript errors in the console? These are basic HTML/JavaScript debugging steps to take.

Jensd
  • 7,886
  • 2
  • 28
  • 37
1

Did you perhaps intend to code something like this:

<!--WSS IF get-value('action') = 'print' then DO: -->

newPopup("print_preview.html?win=pdf&programname=pdf_sample2.p",1250,1250);

<!--WSS ELSE IF get-value('action') = 'go' then DO: -->

newPopup("print_preview.html?win=pdf&programname=pdf_sample.p",1250,1250);

<!--WSS END. -->
Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
  • no, it has to have 'true' in both IF conditions to go to the sample2.p. and if the first IF statement returns 'true' and the second one 'false', then it will go to the sample.p. – user1023 Jun 16 '14 at 00:54
  • How is it possible for action to simultaneously equal 'print' and 'go'? – Tom Bascom Jun 16 '14 at 12:28