Oracle APEX cannot save a value into a session
I have a page item P2_ITEM_TYPE_ID
that gets set in Pre-Render, using a process calling PL/SQL:
BEGIN
select ITEM_TYPE_ID INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
exception
when no_data_found then
:P2_ITEM_TYPE_ID := null;
END;
Currently the record for that ITEM_ID does not exist in TABLE1 so the exception NO_DATA_FOUND is thrown and originally the ITEM_TYPE_ID is set to null.
Now I want to set the ITEM_TYPE_ID by clicking on one of the cards on the page, grabbing its ID and setting page item P2_ITEM_TYPE_ID to that ID.
I have a dynamic action that runs the following javascript when card is clicked:
var $item_type_id = this.data;
console.log($item_type_id); //prints out correect ID
apex.item("P2_ITEM_TYPE_ID").setValue($item_type_id);
console.log(apex.item("P2_ITEM_TYPE_ID").getValue()); //prints out correct value
//set session state of P2_ITEM_TYPE_ID
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE",
{
x01: $item_type_id,
pageItems: "#P2_ITEM_TYPE_ID"
},
{dataType: 'text'} );
I know the code works, as the correct values get printed to the console, but when I check the session of the page, P2_ITEM_TYPE_ID is blank in session. What could be the problem?
It is almost as if something is preventing th value from changing.
I have identical setup on another page with one small difference - the code in the pre-render does not include the exception part because there is always a record in TABLE1 for that ITEM_ID:
BEGIN
select ITEM_TYPE_ID INTO :P3_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P3_ITEM_ID;
END;
But the rest of the code is identical and session of P3_ITEM_TYPE_ID changes without an issue
oracle oracle-apex oracle-apex-5.1
add a comment |
I have a page item P2_ITEM_TYPE_ID
that gets set in Pre-Render, using a process calling PL/SQL:
BEGIN
select ITEM_TYPE_ID INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
exception
when no_data_found then
:P2_ITEM_TYPE_ID := null;
END;
Currently the record for that ITEM_ID does not exist in TABLE1 so the exception NO_DATA_FOUND is thrown and originally the ITEM_TYPE_ID is set to null.
Now I want to set the ITEM_TYPE_ID by clicking on one of the cards on the page, grabbing its ID and setting page item P2_ITEM_TYPE_ID to that ID.
I have a dynamic action that runs the following javascript when card is clicked:
var $item_type_id = this.data;
console.log($item_type_id); //prints out correect ID
apex.item("P2_ITEM_TYPE_ID").setValue($item_type_id);
console.log(apex.item("P2_ITEM_TYPE_ID").getValue()); //prints out correct value
//set session state of P2_ITEM_TYPE_ID
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE",
{
x01: $item_type_id,
pageItems: "#P2_ITEM_TYPE_ID"
},
{dataType: 'text'} );
I know the code works, as the correct values get printed to the console, but when I check the session of the page, P2_ITEM_TYPE_ID is blank in session. What could be the problem?
It is almost as if something is preventing th value from changing.
I have identical setup on another page with one small difference - the code in the pre-render does not include the exception part because there is always a record in TABLE1 for that ITEM_ID:
BEGIN
select ITEM_TYPE_ID INTO :P3_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P3_ITEM_ID;
END;
But the rest of the code is identical and session of P3_ITEM_TYPE_ID changes without an issue
oracle oracle-apex oracle-apex-5.1
I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
– romeuBraga
Nov 13 '18 at 5:38
add a comment |
I have a page item P2_ITEM_TYPE_ID
that gets set in Pre-Render, using a process calling PL/SQL:
BEGIN
select ITEM_TYPE_ID INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
exception
when no_data_found then
:P2_ITEM_TYPE_ID := null;
END;
Currently the record for that ITEM_ID does not exist in TABLE1 so the exception NO_DATA_FOUND is thrown and originally the ITEM_TYPE_ID is set to null.
Now I want to set the ITEM_TYPE_ID by clicking on one of the cards on the page, grabbing its ID and setting page item P2_ITEM_TYPE_ID to that ID.
I have a dynamic action that runs the following javascript when card is clicked:
var $item_type_id = this.data;
console.log($item_type_id); //prints out correect ID
apex.item("P2_ITEM_TYPE_ID").setValue($item_type_id);
console.log(apex.item("P2_ITEM_TYPE_ID").getValue()); //prints out correct value
//set session state of P2_ITEM_TYPE_ID
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE",
{
x01: $item_type_id,
pageItems: "#P2_ITEM_TYPE_ID"
},
{dataType: 'text'} );
I know the code works, as the correct values get printed to the console, but when I check the session of the page, P2_ITEM_TYPE_ID is blank in session. What could be the problem?
It is almost as if something is preventing th value from changing.
I have identical setup on another page with one small difference - the code in the pre-render does not include the exception part because there is always a record in TABLE1 for that ITEM_ID:
BEGIN
select ITEM_TYPE_ID INTO :P3_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P3_ITEM_ID;
END;
But the rest of the code is identical and session of P3_ITEM_TYPE_ID changes without an issue
oracle oracle-apex oracle-apex-5.1
I have a page item P2_ITEM_TYPE_ID
that gets set in Pre-Render, using a process calling PL/SQL:
BEGIN
select ITEM_TYPE_ID INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
exception
when no_data_found then
:P2_ITEM_TYPE_ID := null;
END;
Currently the record for that ITEM_ID does not exist in TABLE1 so the exception NO_DATA_FOUND is thrown and originally the ITEM_TYPE_ID is set to null.
Now I want to set the ITEM_TYPE_ID by clicking on one of the cards on the page, grabbing its ID and setting page item P2_ITEM_TYPE_ID to that ID.
I have a dynamic action that runs the following javascript when card is clicked:
var $item_type_id = this.data;
console.log($item_type_id); //prints out correect ID
apex.item("P2_ITEM_TYPE_ID").setValue($item_type_id);
console.log(apex.item("P2_ITEM_TYPE_ID").getValue()); //prints out correct value
//set session state of P2_ITEM_TYPE_ID
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE",
{
x01: $item_type_id,
pageItems: "#P2_ITEM_TYPE_ID"
},
{dataType: 'text'} );
I know the code works, as the correct values get printed to the console, but when I check the session of the page, P2_ITEM_TYPE_ID is blank in session. What could be the problem?
It is almost as if something is preventing th value from changing.
I have identical setup on another page with one small difference - the code in the pre-render does not include the exception part because there is always a record in TABLE1 for that ITEM_ID:
BEGIN
select ITEM_TYPE_ID INTO :P3_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P3_ITEM_ID;
END;
But the rest of the code is identical and session of P3_ITEM_TYPE_ID changes without an issue
oracle oracle-apex oracle-apex-5.1
oracle oracle-apex oracle-apex-5.1
edited Nov 12 '18 at 21:02
Littlefoot
20.9k71433
20.9k71433
asked Nov 12 '18 at 20:43
Coding DuchessCoding Duchess
2,39163084
2,39163084
I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
– romeuBraga
Nov 13 '18 at 5:38
add a comment |
I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
– romeuBraga
Nov 13 '18 at 5:38
I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
– romeuBraga
Nov 13 '18 at 5:38
I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
– romeuBraga
Nov 13 '18 at 5:38
add a comment |
2 Answers
2
active
oldest
votes
You don't need apex.server.process
for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID
) in the Items to Submit attribute (set PL/SQL Code to just null;
).
But of course! Nice trick!
– Littlefoot
Nov 13 '18 at 5:57
add a comment |
If everything is the same on those pages, except the EXCEPTION
part, well - there's a workaround: use an aggregate function, e.g.
select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
It will prevent the query from returning NO_DATA_FOUND
if there's no value for that :P2_ITEM_ID
and will store NULL
into the :P2_ITEM_TYPE_ID
.
While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
– Coding Duchess
Nov 12 '18 at 21:29
I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript -apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id);
and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
– Coding Duchess
Nov 12 '18 at 21:31
1
Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
– Littlefoot
Nov 12 '18 at 21:31
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269800%2foracle-apex-cannot-save-a-value-into-a-session%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You don't need apex.server.process
for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID
) in the Items to Submit attribute (set PL/SQL Code to just null;
).
But of course! Nice trick!
– Littlefoot
Nov 13 '18 at 5:57
add a comment |
You don't need apex.server.process
for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID
) in the Items to Submit attribute (set PL/SQL Code to just null;
).
But of course! Nice trick!
– Littlefoot
Nov 13 '18 at 5:57
add a comment |
You don't need apex.server.process
for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID
) in the Items to Submit attribute (set PL/SQL Code to just null;
).
You don't need apex.server.process
for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID
) in the Items to Submit attribute (set PL/SQL Code to just null;
).
answered Nov 13 '18 at 2:16
Jeffrey KempJeffrey Kemp
47.9k1187132
47.9k1187132
But of course! Nice trick!
– Littlefoot
Nov 13 '18 at 5:57
add a comment |
But of course! Nice trick!
– Littlefoot
Nov 13 '18 at 5:57
But of course! Nice trick!
– Littlefoot
Nov 13 '18 at 5:57
But of course! Nice trick!
– Littlefoot
Nov 13 '18 at 5:57
add a comment |
If everything is the same on those pages, except the EXCEPTION
part, well - there's a workaround: use an aggregate function, e.g.
select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
It will prevent the query from returning NO_DATA_FOUND
if there's no value for that :P2_ITEM_ID
and will store NULL
into the :P2_ITEM_TYPE_ID
.
While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
– Coding Duchess
Nov 12 '18 at 21:29
I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript -apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id);
and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
– Coding Duchess
Nov 12 '18 at 21:31
1
Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
– Littlefoot
Nov 12 '18 at 21:31
add a comment |
If everything is the same on those pages, except the EXCEPTION
part, well - there's a workaround: use an aggregate function, e.g.
select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
It will prevent the query from returning NO_DATA_FOUND
if there's no value for that :P2_ITEM_ID
and will store NULL
into the :P2_ITEM_TYPE_ID
.
While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
– Coding Duchess
Nov 12 '18 at 21:29
I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript -apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id);
and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
– Coding Duchess
Nov 12 '18 at 21:31
1
Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
– Littlefoot
Nov 12 '18 at 21:31
add a comment |
If everything is the same on those pages, except the EXCEPTION
part, well - there's a workaround: use an aggregate function, e.g.
select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
It will prevent the query from returning NO_DATA_FOUND
if there's no value for that :P2_ITEM_ID
and will store NULL
into the :P2_ITEM_TYPE_ID
.
If everything is the same on those pages, except the EXCEPTION
part, well - there's a workaround: use an aggregate function, e.g.
select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
It will prevent the query from returning NO_DATA_FOUND
if there's no value for that :P2_ITEM_ID
and will store NULL
into the :P2_ITEM_TYPE_ID
.
answered Nov 12 '18 at 21:02
LittlefootLittlefoot
20.9k71433
20.9k71433
While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
– Coding Duchess
Nov 12 '18 at 21:29
I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript -apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id);
and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
– Coding Duchess
Nov 12 '18 at 21:31
1
Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
– Littlefoot
Nov 12 '18 at 21:31
add a comment |
While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
– Coding Duchess
Nov 12 '18 at 21:29
I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript -apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id);
and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
– Coding Duchess
Nov 12 '18 at 21:31
1
Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
– Littlefoot
Nov 12 '18 at 21:31
While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
– Coding Duchess
Nov 12 '18 at 21:29
While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
– Coding Duchess
Nov 12 '18 at 21:29
I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript -
apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id);
and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(– Coding Duchess
Nov 12 '18 at 21:31
I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript -
apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id);
and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(– Coding Duchess
Nov 12 '18 at 21:31
1
1
Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
– Littlefoot
Nov 12 '18 at 21:31
Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
– Littlefoot
Nov 12 '18 at 21:31
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269800%2foracle-apex-cannot-save-a-value-into-a-session%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
– romeuBraga
Nov 13 '18 at 5:38