Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

How to get return value of messageBox()?

Avatar

Former Community Member
hi, hi,



could someone tell me how to get return value of messageBox()? After failed testing with:

if(xfa.host.messageBox(msg," Benutzerdaten Formular",2,2) == 3) {...}

or:

var ret = xfa.host.messageBox(msg," Benutzerdaten Formular",2,2);

if(ret ==3){...}



i dont find the way to solve this problem:(



Reading the help index you can find the return value (1,2,3,4) for each passed events, but how i can get it?



Thanks for your help in advance!
4 Replies

Avatar

Former Community Member
Print the ret param to see what it says... one example of this is:

xfa.host.messageBox(ret);

My guess is that the value 3 is never achieved, the values you are getting is likely 1-2 since your code should be OK.

Avatar

Former Community Member
hi, hi,



thanks for your help! But it doesnt work anyway??? Like my example

"var ret = xfa.host.messageBox(msg," Benutzerdaten Formular",2,2);"

you set an object to the variable "ret". So we have call

xfa.host.messageBox(msg," Benutzerdaten Formular",2,2);

first, but how can i get the return value? What a pity that xfa.host.getReturnValue(); doesnt exist!-)



At last, you can look after messageBox in help from adobe prof. You can get 1/ok, 2/yes, 3/no and 4/cancel as return value but how????



Ok, i try to find it out by myself. See you!

Avatar

Former Community Member
var ret = xfa.host.messageBox(msg);

xfa.host.msgBox(ret);

That will show you the returned value from your message box... after you know the value, correct your code. I guess you never get the value 3 that you've been checking for, my guess is that you will find out it is 1 or 2 instead.



BTW I assume you are using javascript?

Avatar

Former Community Member
hello Mr. Sture Eklund,



sorry for late reply! I dont know why, but it works now!? I get the return value 3 for "no" and 4 for "yes".



Is it the decisive factor whether using java script or formcal script in livecycle designer? For my purpose i use java script for creating dynamic form.



Thank you very much for your help!