Java Scripts for Apex page

Hi All,
i have a Apex page -Report page (having +ve ,-ve numbers)
i have to change the color of the numbers :
1)+ve to Green
2)-ve to Red
2)rest s to Black
how can the Java scripts looks likes for below tables structure
CUSTO   SWITCH       PORT1      PORT2      PORT3                               
JCI     S1               0          4          3                               
JCI     S2              -3          3         -8                               
JCI     S3               6         -7         -5                               
JCI     S4              -2          0          0                               
JCI     S5               0          2          0  
Sum                    1          2         -10
summation happening by using Apex feature
Report Attribute->Report column-sum(check box)
i try to apply the below code in the Region Source of Apex page
Re: coloring  positive and negetive number of a report
like this
SELECT col1,
       CASE WHEN col2 > 0
            THEN '<span style="color:green">'||TO_CHAR(col2)||'</span>'
            WHEN col2 < 0
            THEN '<span style="color:red">'||TO_CHAR(col2)||'</span>'
            ELSE TO_CHAR(col2)
       END col2
FROM   src_data
But the problem i am getting is not able apply to the Sum rows(because it happening by using Apex page feature)
so i want go for Java ScriptsRegards
Amu

Hi Amu,
I don't know if that's the best way to do it, but that's how i handle this:
I usually copy the report template and name it for the specific region. Then I change it by customizing "After rows" specially for the report, adding something something like:
<tr>
<td colspan = "2" class="data" style="text-align: left; font-weight: bold;">Sum</td>
<td class="data" style="text-align: right;"><div id="port_total"> </div></td>
<td class="data" style="text-align: right;"><div id = "port2_total"> </div></td>
<td class="data" style="text-align: right;"><div id="port3_total"> </div></td>
</tr>I calculate the totals in hidden items on my page and then check them in my javascript and display them in the corresponding <div>s, adding style for the positive and negative colours. Something like
document.getElementById('port_total').innerHTML = $v('P1_PORT_TOTAL');
if($v('P1_PORT_TOTAL') > 0) {document.getElementById('port_total').style.color="green";}
if($v('P1_PORT_TOTAL') < 0) {document.getElementById('port_total').style.color="red";}Regards,
Vlad

Similar Messages

  • How to write Java script for refering the 1st page text field from 2nd page?

    Hello I am developing an VISITOR info interactive form with webdynpro ABAP, its with 2 pages. Their heirarchy is,
    VISITOR_form
        |
        |
        |------Page_1
        |            |
        |            |
        |            |------Text_Field_A_1
        |            |
        |            |------Text_Field_A_2
        |
        |------Page_2
                     |
                     |
                     |------Text_Field_B_1
                     |
                     |------Text_Field_B_2
    Now, i have selected the 'Text_Field_B_1' of page_2 and writing the Java script, my requirement is; If Page_1's 'Text_Field_A_2' has a value of "Value_ABCD", THEN the 'Text_Field_B_1' of page_2 should be 'readOnly'. Pls let me know Wht is the Java script for this requirement?

    if (xfa.event.newText=="ABCD")
    VISITOR_form.Page_2.Text_FieldB_1.access ="readOnly";
    place script on change event of Text_FieldA_2

  • How to Enable Custom Java Scripts for forms in Planning 11.1.2.2

    I am working on Planning 11.1.2.2 right now.
    Planning admin guide says, there is no explicit requirement to enable java Script for planning forms.
    I set simple alert to see text "Hello World" in function validateForm() function in custom/validateData.js file - to see and test that alert when I save data for my selected application/form.
    Closed javascript file and workspace, and planning application web page. Since I have not to do anything new to enable this java script alert, I opened that form and saved data to see if I can see my alert.. I got no alert, except "data are saved".
    Has anything changed since last version? Am I missing something? Or, do I need to recycle services to get this alert?
    thanks in advance.

    Thanks guys, for your quick replies..!
    Not sure what I missed, but I still have a hard time finding my "Hello World" alert.
    What I did, is here.
    a. Cleared all cookies and temp files from IE.
    b. Updated validateData.js file from ear / war files using 7-zip program at given path from your link.
    c. Stopped EPM services
    d. Dropped tmp folder.
    e. Started EPM services and let system deploy ear file (with my java script code).
    All services are up. I can see EAR file deployed and java script file ValidateData.js has all my changes in new tmp folder now.
    I am able to open my application and form.
    But, my "Hello World" alert is still not appearing. Form is saved and saw message as usual.
    One exception I noticed in my path. I have ....user_projects\domains\EPMSystem\servers\EPMServer0\.... in place of ....user_projects\domains\EPMSystem\servers\Planning_0\.... in my path. Planning_0 is replaced by EPMServer0 in this version. Rest is all same.
    Any clue? thanks in advance,

  • How to write Java Scripts in Apex

    Hi All,
    Can any on tell me how to write Java Scripts in Apex.
    Thanks in Advance,
    Mukund

    If you want to link your custom JavaScripts to an Apex page, you have several options:
    1. Add an HTML Region on Page 0 (Script will be written to every page) called something like "JavaScript & CSS". In this region add your Script to the region source like this:
    <script language="JavaScript">
    function hell ()
    alert ("Hello World");
    </script>
    2. Add a similar region to the page you are working on (can only be accessed on this page)
    3. Create an external JavaScript file and either load it into the WORKSPACE or into the images (/i/) directory on the server. You can then link the JS into you page via modifying the Page Template.
    Hope that makes sense. Let me know if you want any further help with option 3.
    Duncs

  • Run Java Script from a page proccess

    How do I run the following java script from a page process (PL/SQL anonymous block e.g.):
    javascript:popUp2('f?p=&APP_ID.:70:&SESSION.::&DEBUG.::P70_HEADER_ID:', 700, 700);
    Adding this to a button URL target is not a problem. Is this possible at all?
    Denes Kubicek

    I dont quite understand. Page processing occurs inside the Oracle database server. After page processing is complete, the HTML DB engine branches to the page as per your branching logic and proceeds to render that page. Javascript is a client-side scripting language.
    What does it mean for a Page process to launch a Javascript popup window? Where would that window show up?
    What you probably want is to set some session state in your page process and then write a Javascript function to do whatever you want and attach that to the body onLoad event to popup your windows when the page renders.
    Thanks

  • How to disable a button using Java Script in Apex

    Hi All,
    I was trying to disable a button when the value of a select list item in the same page is equal to zero. Following are the steps which I did.
    1) Created a new button template as <table class="t9StandardButton" id="#BUTTON_ID#" cellspacing="0" cellpadding="0" border="0" summary="">
    2) Changed the existing button template to the newly created button template.
    3) Added onchange="javascript:fdisplay(this);" to form element value of select list
    4) Added the following java script in the page header
    <script type="text/javascript">
    function fdisplay(some) {
    if (some.value==0){
    html_GetElement ('#BUTTON_ID#').disabled = true;
    else
    html_GetElement ('#BUTTON_ID#').disabled = false;
    </script>
    But the script doesn't work. Is there anything I am missing here. Please advice.
    Thanks,
    Vikas

    Vikas:
    In the 'Button Attributes' field of the button enter 'id='thisButton'.
    Modify the button template to include the substitution string #BUTTON_ATTRIBUTES# . This should be put in the anchor tag in the template defintion.
    Modify your Javascript to reference the above id as
    html_GetElement ('thisButton').disabled = true;
    ....Varad

  • "error while evaluating Java script for the package"

    Okay, this is a new one on me! Anyone ever get this message? I don't know what is going on with my iMac, all I know is that about a month ago my iTunes was working fine, and when I just went to use it, it tells me "you can not use the application iTunes with this version of Mac OS X. So I thought maybe something was wrong with my iTunes and downloaded it again and i got the "error while evaluating Java script for the package" when I tried to reinstall iTunes. Another issue I am having is with updates. I haven't received an update for a long time and when I manually check, it tells me there are none.

    Okay, this is a new one on me! Anyone ever get this message? I don't know what is going on with my iMac, all I know is that about a month ago my iTunes was working fine, and when I just went to use it, it tells me "you can not use the application iTunes with this version of Mac OS X. So I thought maybe something was wrong with my iTunes and downloaded it again and i got the "error while evaluating Java script for the package" when I tried to reinstall iTunes. Another issue I am having is with updates. I haven't received an update for a long time and when I manually check, it tells me there are none.

  • Java script for doesn't word (its's made for index)

    Hy,
    I have a java-script, for indexes (for InDesign is CS3) - but it doesn't work.
    I attached 2 files, the first one is the script, the second one is the error-message from InDesign CS3.
    (My friend is working with CS4, the script there is ok.)
    We renewed java-system, because for script, but we haven't better result... :-(
    Please, help me, thanks,
    Anna

    It's a CS3 bug.
    Have a look at this post: http://forums.adobe.com/message/2033721#2033721
    I dont have the time to do it, but you can make it work in both CS3 and CS4.

  • Using java scripts for pdf

    I am trying to find a sort of tutorial on how to use java scripts for pdf files, particularly in setting up repetitive links between several pdf files.

    Here is a very nice website that has tons and tons of stuff for pdf using java script. Enjoy!
    http://www.planetpdf.com/forumarchive/forum34.htm

  • Copy and paste Java script for password protecting a page?

    I need to password protect one page which I want to call my LOGIN page on a site I'm making in Dreamweaver CS5.5.  Unfortunately I know that the hosting company I'm using does not have the ability to allow me password a single directory on the server end to accomplish this (I know STRANGE)   .... SO
    I found some code online - java script that I can just copy and paste into the <head> section of my page.  This might be a silly question but is this a 'safe' way to do this?    (I don't need anything fancy and the people whom will be accessing this page will all have the SAME password, so I don't need a registration form or anything fancier...)
    Any thoughts?

    Ugg I totally knew you would all say that (because I already knew that would offer me the easiest solution), change hosts and now I'm embarrassed to say that YES I am paying for the hosting; BUT, I have to explain that I'm with this hosting company because way back when I started that site I needed something super user friendly because I was just learning.  Now I have learned more and have started to use Dreamweaver.  I just stayed with the same hosting and will use FTP to upload my new more updated site.  In the company's defense even though they do offer a way to FTP a site up, their main objective (I think) is to have a really easy way for people to get a site up without knowing anything about code or css or anything; and they operate under the assumption that MOST of their customers will be using their super easy software and not use FTP.  That is why I think they are limited to what they offer, at least that is my take on it.  My more recent sites do not use this company as I have tried to learn and 'move up'. 
    Anyway I guess if I don't want to switch hosting I still have the same problem.  Is it really that difficult to make something that has just one use ID and password which would be the same thing for every person?  Might be a great learning experience for me?
    Yep it might be time for me to switch hosting....  sigh.  What to do.....

  • How to include a common java script in all pages to prevent browser closure

    We have already implemented a script to prevent accidentally browser closure. The script has been included in a js static file and loaded in APEX 4.01.
    There is a way to make the script available to all pages without including it in all pages ?
    Ad example to make an item available to all pages is sufficient to include it in page 0 there is somethings similar for java script
    Txs
    Giuseppe.

    Reference the script via a <tt>script</tt> element in the Header section of utilised page templates.

  • Java scripting for header,footer and combine PDF as package

    Hi All,
    1.How to add header and footer using scripting.
    2.How can i combine 5 pdf files in to one pdf as PDF file package using Java Scripting.
    Thanks
    Mohamed Idris

    Hi Lenonard,
    Thanks for your reply, I am refering JavaScript for Acrobat API Reference, Version 8 document , but i could not find the right syntax for the above task.
    I am sucessfull writing script for page label but not for insertion of page number in the footer section.
    Regarding combining PDF files i could merge file and it comes as single PDF file not like assembeling pdf files as package.
    Please let me know the syntax and if i am looking at not right documentation, please let me know the document name to refer.
    Thanks again.
    Mohamed Idris

  • Java Script for Blackberry Curve 8900

    I have a BB Curve 8900 on Orange in the UK. I am trying to access live football on the BBC website but it states that Java Script needs to be activated. Can anyone help to resolve this?
    Thanks.
    Dazzler

    Hello!
    That setting is on this page:
    from within the Browser App, ( > Options > Browser Configuration).
    You may also find that changing, also on that screen, your Browser Identification to another browser might help your BB interact better with some websites.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Java script for menu

    Hello,
    As I know, we can use Java script to create client side menu. So user can browser through the menu tree to select the page they want.
    My question is, Can we add more functionnality to this menu tree, so the menu can be anything but URL? ( For example, user browser the menu tree, click a link(or a button?) and call some function(which also writon in Java script) on the client side to perform some action other than call a linked page)
    Thanks
    Hui lu

    Hi,
    You can try like this:
    //in the <head> section write:
    <script language="javascript">
    function callFunc(){
    //some code of yours
    </script>
    //On the menu item write this code:
    <a href = 'javascript:callFunc();'>
    Hope this will serve.
    atanu

  • How can i get java script for apple

    java script turned off cant get it back on.

    The interpreter to handle JavaScript is built in.
    To turn the JavaScript interpreter on and off for all pages:
    Firefox > Preferences > Content tab
    If you already have JavaScript enabled on this tab but some sites tell you that JavaScript is ''not'' enabled, this might be the result of an add-on, a script filter, or many other possibilities.
    You didn't provide a lot of information in your post. Can you indicate where you have this problem, when it started, and whether you recall making any changes in Firefox or on your system before this happened?

Maybe you are looking for