Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Set Item from cookie value using Javascript

danielhOct 22 2012 — edited Oct 22 2012
Hi all,

I have problems setting an Apex item via Javascript. The Value comes from a cookie, so first step by step my code:
1) Create Cookie with encrypted ID
<script type="text/javascript">
document.cookie = 'NACookie=A422313E7F62D04D12347E7DE85DC53E; expires=; domain=&DOMAIN.; path=/';
</script>
2) read Cookie Value and pass it to Varibale (id_per_knd_na)
  <script type="text/javascript">
      function readNACookie()
    {
        var name = "NACookie";
        var nameEQ = name + "=";
        var ca = document.cookie.split( ';');
        var retval = "";
        for( var i=0;i < ca.length;i++)
        {
                var c = ca;
while ( c.charAt( 0)==' ') c = c.substring( 1,c.length);
if ( c.indexOf( nameEQ) == 0) return c.substring( nameEQ.length,c.length);
}
return retval;
}
var id_per_knd_na = readNACookie();


Till to this point everything works fine, i see in the dom tree that i_id_per_knd_na is set correctly to the cookie value "A422313E7F62D04D12347E7DE85DC53E".
But now, i was unable to set a hidden apex page item to this value, heres my last code snippet for this:
$s('P1_ID_PER_KND_NA_CRYPT',id_per_knd_na)
Any ideas to set the page item correctly?
Thanks for your help!

- daniel
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2012
Added on Oct 22 2012
5 comments
616 views