Javascript reference page items

I have a popup window (page 3) in which a user chooses 3 values from seperate static select lists (hours, minutes, am/pm).
I want these values to be returned into three seperate text fields on the page underneath (page 1). How do i reference them?
At the moment I am using the following procedure in the header of the popup:
<script language="JavaScript">
function passBack(passVal1, passVal2, passVal3)
opener.document.getElementById("P1_HOURS").value = passVal1;
opener.document.getElementById("P1_MINUTES").value = passVal2;
opener.document.getElementById("P1_AM").value = passVal3;
close();
</script>
When i press a button, i have a URL redirect to:
javascript:passBack('&P3_HOURS.','&P3_MINUTES.', '&P3_AM_PM.');
should i be using the '&XXXX.' format here? I have used this exact procedure for a Report and used '#XXXX#' format and it worked perfectly.
Please help, by tomorow if possible ;)
Thank you,
Scott

Thanks heaps for you quick reply Patrick.
I copy and pasted your code to my button, and no success. When i hover over the button, the bottom of the browser merely says
"javascript:passBack($x("
Not sure what i did wrong.
I had another solution, to make all of the select lists into "select lists with submit", and then have each of them set the appropriate items on page 1.
The items are set, but they do not appear until I manually refresh the page. So I need a button to refresh the page behind the popup, then close the popup (can close easily, but not sure on how to refresh?).
Any help with either method would be a tremendous help,
Thanks again,
Scott

Similar Messages

  • Customize look of javascript disabled page items

    I'm using javascript to enable and disable text field items on a page based on the user's access level and role. I chose to use a script for this because every item on the page is affected, and it seemed easier to maintain and debug by collecting all the logic together. This is working great, however it isn't looking so great. The background and text colors are both grayish and the end result looks like an etch into metal plating. What I would like is for the javascript disable function to look like when I disable it through APEX, a white background text field with grayed text. How can I customize the disabled look?

    OK so I've tried your guys' suggestions and here are the results along with some more info.
    It looks like APEX sets the attributes for items that are "Disabled, does not save state" as disabled="disabled", but "Disabled, saves state" as readonly="readonly". Not a big deal, I can just fix both styles. However, the problem is the javascript disable function seems to be overriding the CSS style.
    My javascript function enableDisableItems() is run onload and has a bunch of lines that conditionally run $x_disableItem('P801_MY_ITEM',true); If I don't run enableDisableItems, I can see my CSS styles. But, if I do run it, the styles go away and I'm left with the old metallic look again. I'm guessing that not only does the javascript change the items' state, but also style. I don't understand why it's doing that or how to stop it...

  • References pages, items removed

    Hi,
    I have started at a new job and have been experiencing issues with my index template here. After looking at all the template chapter files I noticed that any references to Table of Contents specifications, Index specifications and the HTML mapping table do not exist.
    I did a test and put my index specs back onto the Chapter reference page and rebuilt my book and now the index works correctly.
    Why would anyone delete this stuff off of the reference pages for the Chapter?  I have never worked with any templates that has this information removed, including the ones that come with FrameMaker.
    Using FM Version 8 right now.
    Thanks in advance!

    I don't know how or who created the templates, there is no backup information for them.  But by putting my index specs (as shown here) back on the reference page for the Chapter allows all of my index markers to appear.   If I don't do this, I get some index hits with just a page number.  I removed the old index, removed all the old markers and started fresh, and the problem still appeared, until I did this.
    1, 2–3
    Level3IX
    Level2IX
    Symbols[\ ];Numerics[0];A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z
    <$symbols><$numerics><$alphabetics>
    Level1IX
    openObjectId <$relfilename>:<$ObjectType> <$ObjectId>
    <$pagenum>I am not sure how or who created the templates, but this fix works for whatever reason, putting

  • Access page item from Javascript

    I have searched the forum, and based on my findings this is what I've done so far:
    I have a page item where the Google Map key is stored. I want to access it from Javascript so that I can call the Google map with the key. (Note: The key can't be hardcoded as it will be pulled from DB according to the environment/url the app is running on. e.g. - dev, test, production.)
    Here's a javascript code block:
    <script>
       var google_key = $x('P1_GOOGLE_KEY').value;
       var l_url = "http://maps.google.com/maps?file=api&amp;v=2&amp;key=" +
                   google_key +
                   "&sensor=false";
    </script>I have tried, $v('P1_GOOGLE_KEY') , $x('P1_GOOGLE_KEY') , &P1_GOOGLE_KEY. and none of them work.
    How do I access a page item from Javascript?
    Thx!
    Marc

    Marc,
    I am going to take a shot in the dark, but are you referencing this item outside of a function in your head tag? So basically it tries to reference the item on load? If so this is not going to work because the item does not exist yet. If you are using jQuery change your code to look like:
    $(document).ready(function(){
       var google_key = $x('P1_GOOGLE_KEY').value;
       var l_url = "http://maps.google.com/maps?file=api&amp;v=2&amp;key=" +
                   google_key +
                   "&sensor=false";
    });This will tell the javascript to fire after everything has fully loaded. If you are not using jQuery then you can use a little javascript snippet from here to add a ready event to your page. or you can copy paste this into a script tag.
    (function () {
      var ie = !!(window.attachEvent && !window.opera);
      var wk = /webkit\/(\d+)/i.test(navigator.userAgent) && (RegExp.$1 < 525);
      var fn = [];
      var run = function () { for (var i = 0; i < fn.length; i++) fn(); };
    var d = document;
    d.ready = function (f) {
    if (!ie && !wk && d.addEventListener)
    return d.addEventListener('DOMContentLoaded', f, false);
    if (fn.push(f) > 1) return;
    if (ie)
    (function () {
    try { d.documentElement.doScroll('left'); run(); }
    catch (err) { setTimeout(arguments.callee, 0); }
    else if (wk)
    var t = setInterval(function () {
    if (/^(loaded|complete)$/.test(d.readyState))
    clearInterval(t), run();
    }, 0);
    document.ready(function (){
    var google_key = $x('P1_GOOGLE_KEY').value;
    var l_url = "http://maps.google.com/maps?file=api&amp;v=2&amp;key=" +
    google_key +
    "&sensor=false";
    Good Luck,
    Tyson Jouglet

  • Trouble with using javascript $s function to populate a page item

    Hello Oracle APEX Community,
    I'm working on a drilldown dashboard page and have been encountering a problem when i try to populate a Text Page Item (hidden or not) using the javascript built in $s function.
    The function works great when the data is a number such as dept_id (even if the field type is varchar). However, trying to pass anything which is a text the process fails, except when a value is hard-coded as a parameter for the function. So for example, I have a chart with counts of constituents by state. I would like to populate (filter) a table based on when you click on a bar for a state without having to submit the page. I'm using dynamic actions and a built in javascript function in the SQL for the chart to accomplish this; but again, it works great when I use a varchar field like the FIPS code (i.e. the FIPS for Texas is '48'), but when I try to populate the page item using the state abbreviation 'TX' (again varchar) it fails.
    Here's an example of code that works:
    SELECT 'javascript:$s("P1_DEPTNO",'||d.deptno||')' LINK,
    d.dname LABEL,
    sum(e.SAL) sal
    FROM emp e, dept d
    where e.deptno = d.deptno
    group by 'javascript:$s("P1_DEPTNO",'||d.deptno||')', d.dname And here's an example of code that does not work:
    SELECT 'javascript:$s("P1_DEPTNO",'||d.loc||')' LINK,
    d.dname LABEL,
    sum(e.SAL) sal
    FROM emp e, dept d
    where e.deptno = d.deptno
    group by 'javascript:$s("P1_DEPTNO",'||d.loc||')', d.dname However, when I hard code a text value the script works:
    SELECT 'javascript:$s("P1_DEPTNO","BOSTON")' LINK,
    d.dname LABEL,
    sum(e.SAL) sal
    FROM emp e, dept d
    where e.deptno = d.deptno
    group by 'javascript:$s("P1_DEPTNO","BOSTON")', d.dname
    ORDER BY d.dname I'm encountering this problem on several versions of APEX: (4.0.2.00.07-local installation) and (4.1.0.00.28-apex.oracle.com)
    Does anybody know of this problem and how to solve it? I've looked for settings on the page item itself, and can't figure it out.
    I've re-written my sql to utilize the value fields of my tables instead but I have some objects on the page which are really going to depend on the character based data instead.
    Thanks,
    Wayne

    In your javascript you are generating, surround your value with double-quotes and it'll should then always work with both numbers and strings (your strings are probably being interpreted as variable names and they don't exist at runtime, hence erroring out).
    Example:
    SELECT 'javascript:$s("P1_DEPTNO","'||d.loc||'")' LINK,Edited by: gti_matt on Aug 16, 2011 9:50 AM

  • Javascript help - Hide/Show a page item

    Environment:
    APEX 3.1.00.09 running on AIX 5.3
    Sample application on apex.oracle.com:
    Workspace: GALWAY
    UserID: gwicke
    Password: gwicke
    To see where my issues are:
    1- Start on page 3
    2- In the Agency drop down select 'J & B Marketing'
    3- In the Contract drop down select the only contract that appears
    4- Click on 'Edit Existing Contract'
    5- Note the page item 'LY Closings' has the value 261
    6- Click on the link (really a tab in my theme) at the top labeled 'Cost Detail'
    7- The 'Estimate Justification' is the page item to be displayed/hidden as noted below.
    8- The 'Homes Per Year' under the 'YEAR1' column is the user input page item
    9- The P2_BUILDER_CLOSINGS (value 261 noted above) is the page item to be used in the comparison
    I need to do a couple of things with a potentially hidden page item:
    1- Every time the page loads I need to check to see if the page item (P8_ESTIMATE_JUSTIFICATION) is not null and if it is indeed not null, make it displayed.
    2- When the user enters a value in another page item (P8_HOMES_PER_YEAR1), call a function to see if that value is more than 120% of another page item (P2_BUILDER_CLOSINGS) and if so make the above page item displayed (P8_ESTIMATE_JUSTIFICATION).
    I have the javascript function created (showHideEstimateJustification) and in the HTML Header of the page. The function is being called currently with an onChange check on the page item entered by the user as noted above (P8_HOMES_PER_YEAR1).
    Issues:
    1- I need to force a SUBMIT after the user enters the value for P8_HOMES_PER_YEAR1 so it is available in session state and hence to the javascript function (other ideas welcome!)
    2- I am currently using the x.style.display = 'inline' versus 'none' to hide/show the page item, where x is derived from var x = document.getElementById(P8_ESTIMATE_JUSTIFICATION) Is there a better way????
    Any help is greatly appreciated.
    -gary (a.k.a. Javascript newbie)

    Hi,
    Only your messages use the session state. The code would use the entered value, but you would need to change:
    var homes = parseInt(document.getElementById('P8_HOMES_PER_YEAR1'));to
    var homes = parseInt(document.getElementById('P8_HOMES_PER_YEAR1').value);so that "homes" becomes the numeric version of the value of the item
    Normally, for the label, you would just enter an ID="xxx" into the HTML Table Cell Attributes for the label which you can then use in your javascript. For some reason this doesn't seem to want to work in this page.
    What you could do is find all the labels and then check which is the right one before showing/hiding it. Something along the lines of:
    var xx = document.getElementsByTagName("LABEL");
    var zz;
    var label;
    for (zz = 0; zz < xx.length; zz++)
    if (xx[zz].htmlFor == 'P8_ESTIMATE_JUSTIFICTION")
      label = xx[zz];
    xx[zz].style.display = 'none';
    {code}
    Andy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How do i get current active or selected page item's  reference

    Hi all,
    How do i get current active or selected page item's  reference .
    Please help me

    You can implement a selection suite for your need, this selection suite will be placed into the kLayoutSuiteBoss.
    In this selection suite place a method to give you the UIDRef of the selected pageitem, which you can get by using the method "GetUIDList" of the "ILayoutTarget" interface.
    Manan Joshi
    - Efficient InDesign Solutions -
    MetaDesign Solutions
    http://metadesignsolutions.com/services/indesign-development.php

  • Javascript reading a protected / hidden page item / application item

    Hi
    I'm trying to use javascript to validate / calculate the value of a page item.
    For this I need to access an item that is it protected (not simply a text field which is editable) - or one which is currently hidden.
    Is it possible for javascript to read the value of an application item or a page item that is hidden or a page item that is protected (not editable)?
    Thanks in advance.
    Mike

    Mike, when you change the item type you are changing the html element type
    from
    <input type="text" id="P1_ONE" value="This is P1_ONE item type value" />
    to something like
    <td>This is P1_ONE item type value</td>
    for the text type you would use .value so $('P1_ONE').value or document.getElementById('P1_ONE'). value but for the "display as text" would be $('P1_ONE').innerHTML or document.getElementById('P1_ONE').innerHTML.
    been a while since i use APEX js systax as I've been using jquery but the second example of each type will work.

  • Want a javascript redirect URL using an already defined page item?

    Hello,
    i have a button where i configure a Redirect to URL option... and use : javascript:html_PopUp('http://yahoo.com', '_newwindow');
    That is pretty clear, and it works. I also have a defined page item which does contain a valid URL
    For example :P4_OFFICE_WEB_PAGE_LINK_V:='http://google.com'
    I want the pop up to use a stored value, not the hardcoded one at the top... I have tried all of these, but none seem to work :
    javascript:html_PopUp('P4_OFFICE_WEB_PAGE_LINK_V', '_newwindow');
    javascript:html_PopUp(':P4_OFFICE_WEB_PAGE_LINK_V', '_newwindow');
    javascript:html_PopUp(APEX_UTIL.GET_SESSION_STATE('P4_OFFICE_WEB_PAGE_LINK_V'), '_newwindow');
    What should i use?
    Thanks.

    user12602240 wrote:
    I am a bit novice... sometime i don't know when to use a : (colon) and when not! And i certainly didn't know an ampersand symbol, page item name followed by period (.) will return the value stored. All covered in the documentation.
    Please update your forum profile with a real handle instead of "user12602240".

  • Filter page items by property in Javascript

    What is the Javascript equivalent to this AppleScript?
    set xxx to every page item whose note = "John"
    After looking at some of the tutorials, I pieced this together. Is there a better way of doing this? With 30,000 path items it took over a minute to execute...
    docRef = app.activeDocument;
    var pathLength = docRef.pathItems.length;
    docRef.pathItems[0].note;
    var hitList = []
    for (i = 0; i<pathLength; i++)
    if (docRef.pathItems[i].note= "John")
    hitList.push(i)  
    alert(hitList.length)

    So like this?
    docRef = app.activeDocument;
    var pathLength = docRef.pathItems.length;
    docRef.pathItems[0].note;
    var myCount = 0
    for (i = 0; i<pathLength; i++)
    if (docRef.pathItems[i].note== "JD")
    myCount = myCount + 1
    alert(myCount)

  • Example of setting page item using javascript

    Does anyone have an example of setting the value of a page item (hidden) using javascript? I have seen the following in the Forum but I am having trouble implementing it. If someone could show an example of a region it is called from, and the javascript (and where it is placed), that would be great.
    I have tried something similar to this without luck so far:
    function setValue(){
    $x('P1_FIELD').value = 'Oracle';
    Thanks!
    John

    Hi VS,
    you should really use a "Set Value" dynamic action for that, that's much more transparent than using the onclick definition in the button attributes.
    Regards
    Patrick
    Member of the APEX development team
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How to reference SQL column value for  page item text field

    greetings,
    I created a simple report based on sql query. the query is select employeeid,salary from emp_tbl. under the report column i see employeeid and salary. I created a page item text field with the source type pl/sql function body. inside this source is simple block.
    begin
    if salary < 10000 then
    return (1);
    else
    return (2);
    end if;
    end;
    from the error i take it that it doesn't understand salary. I have tried bind variable (:salary) , hash marks (#salary#), ampersand (&salary.) but nothing works. Is this even possible?
    thank you,
    mon

    Hi Mon,
    I think you will find that anything you do in Forms, you can achieve in Apex, but you may have to think a little differently. Finding direct equivalents in both environments may not be easy or even possible in some circumstances, but with a little knowledge and thought an equivalent overall business flow can be achieved that is just as efficient.
    For example, in Forms where you have a multi row block based on a table, if you need to add any derived fields then you will add these at the block level. I can see that this is what you are trying to achieve in Apex.
    In Apex this will be more easily achieved by specifying the derived fields as part of the query for the region, and if the derivation of the fields is complex you can use user defined functions. If you require page type items to be displayed such as text boxes, LOV's, radiogroups, datepickers etc then these can be embedded in the query with the use of the Apex API, see the APEX_ITEM supplied package.
    I know this is still very high level, but I hope it helps you on your way in your journey with Apex.
    Regards
    Andre

  • Javascript to get Item values

    Hi
    I am very new to javascript so bear with me.
    I am implementing a tabular Form where the Rows can be Updateable/Not Updateable based on a value of another Field.
    The form Displays Quote Lines. The Quote Status is passed from the previous page = DRAFT then lines are updateable else NOT updateable.
    I have looked at this post (Thanks to ATD) which is great!
    Re: A better method of handling tabular forms with variable column type?
    The java script to DISABLE a column based on the value of another Column in the array is as follows(works great):
    function disableItems(checkcolumn, columnvalue, disablecolumn)
    var f1 = document.getElementsByName(checkcolumn);
    var f2 = document.getElementsByName(disablecolumn);
    var k;
    if (f1)
    for (k = 0; k < f1.length; k++)
    if (f1[k].value == columnvalue)
    f2[k].readOnly = true;
    f2[k].style.backgroundColor = 'silver';
    Is there a way to reference an item in the page that is NOT in the array.
    I have an item which appears in the source as name='p_t01'
    var f3 = document.???('p_t01');
    Then in the function would be:
    if (f3.value = columnvalue)
    f2[k].readOnly = true;
    II realise this is very javascript - not APEX specific.
    Hoe you can help.
    Regards
    Chris

    To get element:
    - document.getElementById("element_id")
    - using Jquery -> $("#element_id")
    - using APEX API funct. -> $x("element_id")
    To get value:
    - document.getElementById('element_id').value()
    - using Jquery -> $("#element_id").val()
    - APEX API functions -> $v("element_id")
    In most cases element_id is equal to element_name
    Br,
    Marko
    Edited by: Marko Goricki on Apr 5, 2011 12:45 PM
    Edited by: Marko Goricki on Apr 5, 2011 1:07 PM

  • Validating page item  to be less than 50 charachters

    Hello,
    I have created validation for page item, its string and I want it to be not more than 50 letters,
    I used PL/SQL expression and I used this one
    V('P55_MANAGER_NAME').length > 50
    I got this error
    ORA-06550: line 1, column 47: PLS-00487: Invalid reference to variable 'NEW <expression>' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    Can some one help me in having the right expression??

    TomTom101 wrote:
    Hello,
    I have created validation for page item, its string and I want it to be not more than 50 letters,
    I used PL/SQL expression and I used this one
    V('P55_MANAGER_NAME').length > 50
    I got this error
    ORA-06550: line 1, column 47: PLS-00487: Invalid reference to variable 'NEW <expression>' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    Can some one help me in having the right expression??Well to start with the basic logic is incorrect.
    length > 50means "must be longer than 50 characters".
    Secondly
    V('P55_MANAGER_NAME').length > 50is a mixture of PL/SQL and JavaScript syntax. From the error message it appears you're doing this in an APEX Post-Submit Validation?
    In which case the syntax is
    length(:p55_manager_name) <= 50

  • Muse,Page items slow to load - eliminate render blocking java script?

    Everything was running smooth until I tried to cut and past new items into master pages. Now I have master page items loading out of sequence and very slowly at that. I went to google's page speed insites and I scored a 72% with a reccomendation to "Eliminate render blocking java script in above fold content" as well as "leverage browser caching"
    Well... I have no idea what that means
    any idea how I can improve the performance of my page? I've already compressed the images significantly, I don't think that's the problem. Google talks about expirey dates on cache items being too low or non existant causing delays on pages, and setting priority over viewable items. Can I do this in Muse?
    you can view the site here
    http://batco.businesscatalyst.com

    I've actually been having the same problem - the interesting thing is that I've only really noticed it in the past several weeks (before, everything loaded fine). Could there have been a change in Muse in the way it's loading scripts that is slowing it down?
    Examples:
    www.karlchristiankrumpholz.com
    www.pawdnerscolorado.com
    On the second site, I can't remember if I crunched the images, but on the first one, I used Image Optimizer to crunch down all of the pngs prior to publishing. For reference, I'm publishing both sites via Business Catalyst; one using a free CC account, and one using a paid eCommerce account.
    I ran it through Google PageSpeed, and here's what I get:
    Eliminate Render-Blocking JavaScript and CSS in above-the-fold Content
    Your page has 1 blocking script resources and 5 blocking CSS resources. This causes a delay in rendering your page.
    None of the above-the-fold content on your page could be rendered without waiting for the following resources to load. Try to defer or asynchronously load blocking resources, or inline the critical portions of those resources directly in the HTML.
    Remove render-blocking JavaScript:http://webfonts.creativecloud.com/bebas-neue:n4:all.js
    Optimize CSS Delivery of the following:
    http://www.karlchristiankrumpholz.com/StyleSheets/ModuleStyleSheets.css
    http://www.karlchristiankrumpholz.com/css/site_global.css?4210242644
    http://www.karlchristiankrumpholz.com/css/master_desktop-master.css?4254541493
    http://www.karlchristiankrumpholz.com/css/index.css?3941979157
    http://webfonts.creativecloud.com/c/c3d3d5/bebas-neue:n4.TGd:N:1/d
    Leverage Browser Caching
    Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
    Interestingly, image size doesn't appear to be as much of an issue, according to PageSpeed:
    Properly formatting and compressing images can save many bytes of data.
    Optimize the following images to reduce their size by 30.3KiB (13% reduction).
    Losslessly compressing http://www.karlchristiankrumpholz.com/images/headerbackground.png could save 19.1KiB (22% reduction).
    Losslessly compressing http://www.karlchristiankrumpholz.com/images/laurel.png could save 4.9KiB (29% reduction).
    Losslessly compressing http://www.karlchristiankrumpholz.com/images/rebel_%402x.png could save 4.6KiB (7% reduction).
    Losslessly compressing http://www.karlchristiankrumpholz.com/images/karlheader2-u1353.png could save 1,019B (2% reduction).
    Losslessly compressing http://www.karlchristiankrumpholz.com/images/arrowmenudown.gif could save 707B (84% reduction).

Maybe you are looking for

  • Even BT Openreach Engineer believes fault is in eq...

    This is a follow on from my original issue reported a week ago (That post has been marked as Sorted!!!) about waiting the 10 days after install of BT Infinity with good upload but bad download speeds. a very bad IP Profile on the line Finally got BT

  • HEADER TEXT IN ALV

    hi all, I am unable to get the header in my alv report. can any body let me know where it went wrong.

  • Cannot start mpd as systemd service

    Hi all, I have installed mpd. If I run mpd from a terminal, then everything is normal; I can open a client and use mpd. However, if I try to start it as a systemd service I get errors. That is, once I do sudo systemctl enable mpd and reboot, then jor

  • After Mountain Lion install Time Machine states no existing backup

    I upgraded to Mountain Lion and can use "Enter Time Machine" to see previous back ups.  However, the other time machine related windows (e.g. the control panel) state there is no existing back up and, accordingly, no last back up time.  I am concerne

  • Strcures fileds into SAP BI

    If i have the tables and their fileds in r3 i can exatcrt that data by using the generic datasource. If i have the reports in r3 which are exatcting the data from strcutres..how can i get that data into BI? Regards Srinivas Edited by: Srinivas Gogine