admin管理员组

文章数量:1386475

when i use javascript eval() to open apex url from js i have no problem when i use eval() like this

 eval("f?p=&APP_ID.:7:&SESSION.");

but when i wanna pass parameters with eval() like this

eval("f?p=&APP_ID.:7:&`SESSION.:P7_ID:8461,P7_ALLOWCHANGE:1,P7_WFDEF_ID:69004.");`

i get this error: SyntaxError: expected expression, got ':'

then these parameters automatically added after generating url

javascript:apex.navigation.dialog('f?p=101:7:28809985622510:::::\u0026p_dialog_cs=_7P7TVFV5LTQPjeyg-bGqSKpcYM',{title:'Workflow State',height:'auto',width:'720',maxWidth:'960',modal:true,dialog:null},'t-Dialog-page--standard '+'',this);:P7_ID:8461,P7_ALLOWCHANGE:1,P7_WFDEF_ID:69004.;

what should i do?

when i use javascript eval() to open apex url from js i have no problem when i use eval() like this

 eval("f?p=&APP_ID.:7:&SESSION.");

but when i wanna pass parameters with eval() like this

eval("f?p=&APP_ID.:7:&`SESSION.:P7_ID:8461,P7_ALLOWCHANGE:1,P7_WFDEF_ID:69004.");`

i get this error: SyntaxError: expected expression, got ':'

then these parameters automatically added after generating url

javascript:apex.navigation.dialog('f?p=101:7:28809985622510:::::\u0026p_dialog_cs=_7P7TVFV5LTQPjeyg-bGqSKpcYM',{title:'Workflow State',height:'auto',width:'720',maxWidth:'960',modal:true,dialog:null},'t-Dialog-page--standard '+'',this);:P7_ID:8461,P7_ALLOWCHANGE:1,P7_WFDEF_ID:69004.;

what should i do?

Share Improve this question edited Jun 27, 2017 at 12:01 Hleb 7,39115 gold badges64 silver badges127 bronze badges asked Jun 23, 2017 at 8:29 samansaman 411 gold badge1 silver badge11 bronze badges 1
  • docs.oracle./database/121/HTMDB/concept_url.htm#HTMDB03018 . Make sure this format is being followed.. The pre generated URL you have is not correct. – theCJCsoccer Commented Jun 27, 2017 at 17:34
Add a ment  | 

3 Answers 3

Reset to default 1

The best way would to be to use apex_page.get_url It is so much simpler to use than apex_util.prepare_url

https://docs.oracle./cd/E59726_01/doc.50/e39149/apex_page.htm#AEAPI30190

I don't know about your eval call, but this APEX URL syntax is wrong:

f?p=&APP_ID.:7:&`SESSION.:P7_ID:8461,P7_ALLOWCHANGE:1,P7_WFDEF_ID:69004.

All the item names should be listed together, then all the values together - and after the correct number of colon separators:

f?p=&APP_ID.:7:&SESSION.::::P7_ID,P7_ALLOWCHANGE,P7_WFDEF_ID:8461,1,69004

I also removed the spurious back-tick character from before "SESSION".

Apart from what Tony Andrews covered, here are a few more issues with your URL: 1. it's APP_SESSION - not SESSION. Here's documentation on built in substitution strings. 2. Your items are not substituted properly. Read this documentation page more details on substitutions in APEX.

Here's documentation on understanding APEX URL syntax.

Secondly, here's what you would try. Create a hidden page item and use APEX_UTIL.PREPARE_URL function and generate valid url, assign to the item. And use that item as url in your javascript. I haven't tried this, but this would be a better approach, I think.

Also prepare url like this:

APEX_UTIL.PREPARE_URL('f?p=' || :APP_ID ||':7:' || :APP_SESSION || :::' ||:P7_ID: ',' || :P7_ALLOWCHANGE || ',' || :P7_WFDEF_ID || ':8461,1,69004')

Here's another great resource to understand apex url and how to pass variables: http://dgielis.blogspot.in/2015/01/understanding-apex-url-passing.html

本文标签: Open Oracle Apex URL with JavaScript when giving parametersStack Overflow