Not sure I know how you're coding this. is "processMenuOption" coded in a separate JS file and you call it from the "onoptionclick" property? Or are you coding this directly in the property? Or what?
Profound UI will have variables named 'value' and 'text' that are already set prior to running your routine. So, since the code you posted here is rather simple (but, of course, I don't know if there is more that you didn't post) it might be easy enough to just code it directly in the onoptionclick rather than defining a function.
So, if you did it that way, you could simply put this (without the 'function' definition) in your onoptionclick:
Code: Select all
switch(value) {
case "F200":
// code to process menu option 01 would go here
window.open("http://intra.smtl.com:8500/pdf/f200.pdf");
break;
}
Or, if the PDF name always matches the "choice values" of the selected item, then you could simplify it to this:
Code: Select all
// since "value" wil contain "F200", this will launch F200.pdf
window.open("http://intra.smtl.com:8500/pdf/"+ value + ".pdf");
Also, if "intra.smtl.com:8500" is the same server instance that you are running Profound UI on, I would leave that out of the URL. That way, if you ever change your server name or try to run this on a different server, you won't have to change your code. In that case, it'd look like this:
Code: Select all
// since "value" wil contain "F200", this will launch F200.pdf
// this is a "relative" URL, it will launch documents from the server instance that my display is served from.
window.open("/pdf/"+ value + ".pdf");
If your code is more complex and would benefit from putting it in a separate .js file, then you would want to keep the "function" parts the way you had them before and call it like this...
... this would make debugging a lot easier, so it makes a lot of sense for a more complex routine. The earlier suggestions are only given because your routine seems so simple that it may not be worth the extra effort of putting it in a separate file -- but it's up to you.
Does that help?