JavaScript: Disabling textarea in report column cell  depending on flag

Hi,
I got an updateable report with the following behavior:
- Depending on the value of column "PFT_PCODE" (1 or 2) the column gets a yellow or red background color.
- If the value of column "PFT_PCODE" is 1 the next column (for remarks) gets a grey background color.
- Some flags get values set.
With the kind help of Andy (ATD) I got that running nicely. See also:
Javascript - Referencing report column value and
JavaScript: Disabling textarea in report column cell
Now I want to add an additional feature:
- If a flag ('P11_SPERR_FLAG') has the value '1' then the column (remarks) (var j) should be disabled.
I tried the following (see additional code between asterisks) but it's not working. I feel a little stupid since I thought that shoud be an easy fix.
Anyone has an idea what's wrong with the additional code? I find debugging quite difficult in JavaScript...
////////////////// PAGE HTM HEADER //////////////
function hilite(f1) {
var ft1 = document.getElementById('P11_FEHLERTYP1_FLAG');
ft1.value = '0';
var ft2 = document.getElementById('P11_FEHLERTYP2_FLAG');
ft2.value = '0';
*var sperrflag = document.getElementById('P11_SPERR_FLAG');*
var h = 0;
if (document.getElementById(f1)) {
     h = document.getElementById(f1);
     var t = h.parentNode;
     while (t.tagName != 'TABLE') {
          t = t.parentNode;
     var rows = t.rows;
     var k;
     var i;
     var j;
     var c;
     var headers = t.getElementsByTagName("TH");
     for (k = 0; k < headers.length; k++) {
          if (headers[k].id == f1) {
               c = k;
     for (k = 1; k < rows.length; k++) {
          i = rows[k].cells[c];
          j = rows[k].cells[c+1].getElementsByTagName("TEXTAREA")[0];
          *if (sperrflag.value == '1') {*
*               j.disabled = 'true';*
          if (i.innerHTML == '2') {
               i.style.backgroundColor = 'yellow';
               i.style.color = 'white';
               i.style.fontWeight = 'bold';
               i.style.fontSize = '18px';
               ft2.value = '1';
          if (i.innerHTML == '1') {
               i.style.backgroundColor = 'red';
               i.style.color = 'white';
               i.style.fontWeight = 'bold';
               i.style.fontSize = '18px';
               j.style.backgroundColor = 'grey';
               ft1.value = '1';
               //j.disabled = 'true'; //This would work.
////////////////// REGION FOOTER //////////////
<script type="text/javascript">
hilite('PFT_PCODE');
</script>Thank you,
Roger

I found the solution, it had nothing to do with JavaScript:
Item P11_SPERR_FLAG was of type Diplay as Text / Doesn't save state.
Without saving state the JavaScript wouldn't work.
Sorry to bother,
Roger

Similar Messages

  • JavaScript: Disabling textarea in report column cell

    Hi,
    Andi (ATD) helped me with formatting report columns, coloring them depending on a value. See:
    Javascript - Referencing report column value
    Now I want to add a feature:
    If the value is '1' then disable the textarea in the next column, otherwise not. The function is:
    function hilite(f1)
    var h = document.getElementById(f1);
    var t = h.parentNode;
    while (t.tagName != 'TABLE')
      t = t.parentNode;
    var rows = t.rows;
    var k;
    var i;
    var j;
    var c;
    var headers = t.getElementsByTagName("TH");
    // var textarea = t.getElementsByTagName("textarea");
    for (k = 0; k < headers.length; k++)
      if (headers[k].id == f1)
        c = k;
    for (k = 1; k < rows.length; k++)
      i = rows[k].cells[c];
      j = rows[k].cells[c+1];
      if (i.innerHTML == '2')
        i.style.backgroundColor = 'yellow';
        i.style.color = 'white';
        i.style.fontWeight = 'bold';
        i.style.fontSize = '18px';
      if (i.innerHTML == '1')
        i.style.backgroundColor = 'red';
        i.style.color = 'white';
        i.style.fontWeight = 'bold';
        i.style.fontSize = '18px';
    //  j.style.backgroundColor = 'green';   // testing purpose; colors background green but not textarea
        j.style.visibility = 'hidden';               // works fine but ugly
    //  j.disabled = 'true';                        // nothing happens
    //  j.firstChild.disabled = 'true';           // does not work
    //  j.textarea.disabled = 'true';           // does not work
    }See the 'j' object: I can make the whole cell disappear but it looks ugly. Examining it with firebug I was thinking I must use sth. like firstChild or textarea, but it does not work. I find it still quite tricky to manipulate tables in Apex...
    Could someone help with this?
    Thanks a lot,
    Roger

    Hi Roger,
    You're sort of nearly there!
    The next cell to the right of the one you are testing will contain a TEXTAREA object. Your j variable can get to this using something like:
    j = rows[k].cells[c+1].getElementsByTagName("TEXTAREA")[0];The issue with using the visibility method that you have used will then disappear as you've applied it to the whole TD object, so all borders will go - applying this to the new j will only hide the textarea object instead.
    Andy

  • How to write a javascript function on a report column with type select list

    I have a report with a select list column:
    HTMLDB_ITEM.SELECT_LIST_FROM_LOV(22, "tablename"."PRIMARY", 'PRIMARY').
    The value of primary can be null, yes, no. I want to write a javascript to achieve this: once the user changes one primary value to be yes, others with 'yes' will be changed to 'no' automatically.
    Could somebody help me on this.
    Thanks.
    Jen

    Thanks Patrick for your quick reply.
    I created a dynamic action with the following steps, but the dynamic action is not taking place.
    Event: After Refresh
    Selection Type: Region
    Region: Report 1 (my report name)
    Then in the true action
    Action: Execute Javascript SCode
    Code: showHighlight();
    I even tried to get an alert, but the dynamic action is not done at all. It seems the After refresh dynamic action is not working for a region.

  • Report with long column cell value

    Hi,
    we have report with some number of columns and some columns cells have value with a lot of chars (more than 100). We would like to trim this column cell value to for example 20 chars and put all chars of column cell value to HTML TD title value as "hint". Something like this:
    <code>
    <td #ALIGNMENT# headers="#COLUMN_HEADER_NAME#" title="#FULL_COLUMN_VALUE#" class="data">#TRIMED_COLUMN_VALUE#</td>
    </code>
    It is possible do this by template? Do you have any idea?
    I have one idea that use JavaScript and full column value in hidden column, but I thing that there could be some better way to do this:-)
    With regards.
    David
    Edited by: user4893970 on Nov 23, 2010 4:11 PM

    While I don't think there's any way to do this with a normal reportIf it is a standard report and not an interactive report, then it can be done using the column HTML Expression:
    <span title="#FULL_COLUMN_VALUE#">#TRIMMED_COLUMN_VALUE#</span>

  • Javascript - Referencing report column value

    Hi,
    In my application I have a report "Test" with some columns. In column "PFT_PCODE" the possible values are either 1 or 2.
    What I want is to display the report table cell in red, if the value in "PFT_PCODE" is 1, or the table cell in orange, if the value in "PFT_PCODE" is 2, respectively.
    I tried to make something in Javascript, based on a Vikas' example. I put in the
    Region Header:
    <style type="text/css">
    .rot {
    background-color: red;
    .orange {
    background-color: orange;
    </style>
    Region Footer:
    <script type="text/javascript">
    var spans=document.getElementsByTagName('span');
    for (var j=0;j<spans.length;j++) {
    if (spans[j].className=='farbe') {
    var td=html_CascadeUpTill(spans[j],'TD');
    if (document.getElementsById('#PFT_PCODE#').value == 1) {
    td.className = 'rot';
    else {
    td.className = 'orange';
    </script>
    The column "PFT_PCODE" is marked as CSS class "farbe".
    Unfortunately it's not working, I'm not sure if I reference the report column value right. Since I'm a beginner in Javascript I would be glad for help.
    I put my (reduced) application on apex.oracle.com for testing.
    Workspace: app
    Login: [email protected]
    PW: riponi
    Thanks in advance,
    Roger

    Hi Roger,
    In your report, if you do a View Source, do your report headers have id's on them - that is, the TH tags that contain the headings?
    If so, you could use:
    &lt;script type="text/javascript"&gt;
    function hilite(f1)
    var h = document.getElementById(f1);
    var t = h.parentNode;
    while (t.tagName != 'TABLE')
      t = t.parentNode;
    var rows = t.rows;
    var k;
    var j;
    var c;
    var headers = t.getElementsByTagName("TH");
    for (k = 0; k &lt; headers.length; k++)
      if (headers[k].id == f1)
        c = k;
    for (k = 1; k &lt; rows.length; k++)
      j = rows[k].getElementsByTagName("TD")[c];
      if (j.innerHTML == '2')
        j.style.backgroundColor = 'purple';
        j.style.color = 'yellow';
      if (j.innerHTML == '1')
        j.style.backgroundColor = 'red';
        j.style.color = 'white';
    &lt;/script&gt;Put that in the page's HTML Headers setting.
    In the report region's Region Footer, add in:
    &lt;script type="text/javascript"&gt;
    hilite('PFT_PCODE');
    &lt;/script&gt;This will find the heading's TH cell, work out where it is in the row, then loop through all remaining rows and check the TD cell in the same column, highlighting the cell using background and font colours.
    Andy

  • Need help with Javascript to get value of standard report column

    Hello All,
    Apex version 3.1
    I have a SQL Query (Updateable report) region where I need to do some validations using an OnDemand Applicaiton Process and javascript. For this validation I need to use the serial number and the item id from the same report row. The function is called when the serial number is changed. I can get the serial number easily because it is a Text field, however the item id is a standard report column (making it a text field or hidden gives me a checksum error, long story). How do I get the value for the standard report column in order to set the value for an Application item to be used in my Application Process along with the serial number? Here is my code below.
    <script>
    function f_ValidateSerial(pThis)
      // The row in the table
      var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
        //alert('Row is '+vRow);
      // Display the serial number
        //alert('The Serial Number is '+html_GetElement('f21_'+vRow).value);
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ValidateSerial',0);
    get.add('F101_SERIAL_NUMBER',html_GetElement('f21_'+vRow).value);
    get.add('F101_INVENTORY_ITEM_ID',+html_GetElement(?????+vRow).value);   // Here's where I need to get the item id to set application item!!
    gReturn = get.get();
    if (gReturn)
          alert(gReturn);
      if(gReturn)
          html_GetElement('f21_'+vRow).value = '';
    </script>

    jarola wrote:
    Hi,
    Ok, No standard report column do not have name attribute-
    You can add one extra column to report that is your Item Id with different alias.
    Then change that column Display as to "Hidden".
    Now you have hidden input where is your Item Id. Than input have name and id.
    Regards,
    JariBut this puts me back to my initial problem. When making the column hidden I get the checksum error...
    Error in mru internal routine: ORA-20001: Error in MRU: row= 0, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process...
    The item id is NOT in the table which I am updating (I use a subquery to get the data) so I think it has to be a standard report column. Hidden and Text Item (which have an item id) all generate the checksum error.
    So I think I'm back to my original question. Given a standard report column on a row in a sql query (updateable report) region how do I get the value using Javascript?
    Edited by: blue72TA on Aug 2, 2011 12:07 PM

  • Javascript in report column headings?

    Hello,
    I'm wondering if it's possible to be able to use Javascript in report column headings, so that when the user hovers the mouse over the column heading name in the report, a pop-up appears with an explanation of what that column is. Usually I use Javascript on page items, but in this case, the column headings aren't page items, they are derived from the SELECT statement that makes the report. Is this possible using Javascript? Or, is there something I'm not aware of that Apex can do, such as the "Optional Label with Help" but for column heading names?
    Thank you,
    Laura

    Hello Laura,
    Each report column headings has an ID equal to the column name/alias as it appears in your select statement. You can use this ID to directly access the column header DOM node, just as you are doing with a page item.
    In your case, you can use the ‘title’ attribute to get what you want. If your column ID is ‘COL1’, you can use something like this in the footer of your report region:
    $x(‘COL1’).title = ‘Help Text’;Of course, having an ID allows you to use any JavaScript code you need.
    Hope this helps,
    Arie.

  • Javascript:popupPage in Reports Column

    hello All ,
    How do I referance an external popup URL in a Report column?
    for example i want to call something like
    https://www.uranu.GOV/CSSWebView

    you can use an existing function named "popUp2."
    go to colunm attributes
    Under Column Link:
    Choose an icon or your column value (i.e. #yourcolumnname#) as linked text
    Change Target to URL
    In the URL box, enter javascript:popUp2('your_url',775,425); The values at the end are the dimensions of the popup window.

  • Display an alert message through javascript when report column item is null

    Hello,
    I have a report column item which is an select list item and now i want to display an alert message when value is null, I mean no value is selected, this alert message should be fired when update button is clicked.
    Can anyone please help me with this issue.
    Thanks,
    Orton

    You could try something like this:
    declare
      x        INTEGER;
      err_ct  INTEGER   := 0;
    begin
      x  := 5;  -- number of rows displayed
      for i in 1 ... x (
        IF wwv_flow.g_f08(i)) IS NULL THEN err_ct  := err_ct + 1;
        END IF;
      end loop;
      IF err_ct = 0 THEN
         RETURN NULL;
      ELSE
        RETURN 'Nice error message: you must supply a value.';
      END IF;This would be used with a PL/SQL validation: Function Returning Error Text.

  • Conditional display of list box in form (depends on other report column)

    Hello,
    i have one question regarding conditional display in forms.
    I have a tabular form where only one column ("flag") is updateable, all other columns are visible only.
    I changed the column "flag" from "standard report column" to "Select list (static lov)", which has the values "yes" and "no".
    This works fine. But in the running form i want to display the list box only if the column "status" = 'ERROR'.
    The column "status" can have the values 'ERROR' and 'OK'.
    When one record has "status" = 'OK', the column "flag" should not display the list box (only empty column row),
    when one record has "status" = 'ERROR" the column "flag" should display the list box.
    The idea behind is that if a record has "status" = 'ERROR' i have the possibility to confirm that "error" and update the column "flag" with "YES". This should only be possible for errors.
    This is my main problem.
    I tried with conditional display, but this hides or shows the column for the whole report/form, not on record level...
    The second problem then is, that if the column "flag" is changed to "YES" in case of column "status" = 'ERROR', then it should not be possible to change it again to 'NO". At the beginning it is 'NO', but once changed to 'YES' it should not be changeable any more.
    Is this possible?
    Thank you in advance,
    Matthias

    Hello Mike
    your solution sounds good, but unfortunately it is not working.
    None of my 2 columns are displayed, although i tried it as you wrote and the conditions should match...
    But i am no sure if this can work. If so, the 2 columns must fuse to 1 column:
    ID STATUS FLAG
    1 ERROR yes/no => comes from column1
    2 OK (null => comes from column2
    so "FLAG" must display column1 and column2 in one column. is that possible?
    regards,
    Matthias

  • Call Javascript function to pass a id  from APEX report column link

    Hi,
    Can anyone help me, in a report column link i'm calling a function to pass an id and i want to onclick change a icon on that column based on the value on the column status of this table.
    Is this possible?

    Hi Ron,
    I am doing exaclty what you have suggested me but no luck. I started changing the DEMO_CUSTOMERS application to my requirements.The report is working fine and on the report I have created a page attribute to the Hyper linked column and linked that to the page 2 and assign that attribute with #JOBNUM#.
    I am able to pass that value on to form when I click on the JOBNUM. But the problem is I am not able to pass that value into the SQL query so that my query pulls 20+ columns on to the Form ( which is second page ).
    Small clarification... On the form region it is said FORM NAME and type is HTML is that is the way the APEX was designed or does it need to say region type as FORM.
    Thanks for your help in advance.
    Cheers,
    Krishna.

  • Cannot edit a field that is "Standard Report Column" when new row added

    Hi everyone,
    I have created a master-detail form from the wizard and within the detail report region source I have used apex_item.xxx API
    example;
    select C1, C2,
    CASE when C2 ='N' then
    apex_item.select_list_from_query(3, C3,'select a1 d, a2 r from table1', 'ENABLED', 'NO',null,null, 'f03_#ROWNUM#')
    else
    apex_item.select_list_from_query(3, C3,'select a1 d, a2 r from table1', 'DISABLED', 'NO',null,null, 'f03_#ROWNUM#')
    END C3
    from table;
    All columns C1,C2,C3 are defined as "Standard Report Columns".
    The results allows the column C3 field to be enabled or disabled for input depending on a condition.
    The problem is when you hit the default button "Add Row" to add a new row. The row is non-editable and is populated with null values.
    What I want is to allow input when a new row is inserted into the multi-row detail form.
    Can any one help?
    Is there a way to change the Display As field for the new row columns to "text field" from "standard report column" dynamically?

    I think you will need to use the old way of adding rows instead of the new one. I remember having headaches trying to get it working.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How to accessing current row report column value in Lov Query?

    Hi,
    which access methods (eg. bind variables, substitutions, ...) for getting the current row report column value can be used in the "Lov Query" property of a report column?
    As what I know of and what I have read on the forum there are no bind variables for the report columns. For the "Link Text" property it seems that the column values exist as substitution strings (#COLUMN_NAME#). But they don't work in the Lov Query. => And would be good because of a hard parse each time the Lov query is executed.
    The following post (Re: Simulating a correlated sub query in lov
    is showing a solution to use package variables for temporary storage of the referenced value, but the only problem with that solution is that if a new record is added with the "Add rows to tabular form" process the package variable still contains the value from the last queried row! Is there a way (variable, APEX package, ...) to determine if the lov query is executed for a new record so that the package can return null?
    I know that I could write the package in a way that the value is immediately cleared when lov_pkg.keyval is called (one time read), but then I would have to create several variables if I'm accessing the value multiple times in the query or in another query => I think an one time read solution would be very obscurely.
    Thanks for your help
    Patrick
    http://inside-apex.blogspot.com

    Hi Patrick,
    I agree that it's a waste to continually use Ajax to go back to the server to get the contents of a dynamic select list.
    There are no bind variables for any row item - but what you do have, as per my previous post, is the value of the data entered by the user in the first row. You can pass this into your application process (using get.add("VARIABLENAME", value)), which can use it to retrieve the correct LOV in your Ajax code - this will give you a "bind variable" that your process can use.
    What you could do, however, is generate hidden select lists on your page - one for each possible LOV list and replace the contents of the new row's select list with the contents of the appropriate hidden select list. This is easy to do with javascript (using innerHTML functions). Obviously, though, the usefulness of this depends on the number and size of the select lists.
    Even if you don't generate them to start with, you can keep a copy of any select lists returned by Ajax in the DOM for use on new rows. So, if you have retrieved a select list, you will have a copy of it in DOM which you can then copy into the new row. If you don't have the list in DOM, use Ajax to get it, store a copy of it and copy it into the new row.
    Which method you use will depend on the number/size of select lists needed. If they are few in number and/or size, I would suggest generating hidden lists. If they are large, use Ajax to get them once, store them and then retrieve them from the DOM when needed.
    There is another thread here where Arie recommends going to the server every time to make sure you get the most up-to-date data for the lists. If you want to follow this advice, for this reason, use get.add("VARIABLENAME", value) to pass the value to your process. If this is not an issue, you can use one of the other methods I outlined above.
    Regards
    Andy

  • Can we change the background color of a Standard report "column"?

    4.2.1
    Theme 24 - Cloudy
    Hi There,
    I searched this forum and online but did not get a straight forward way to change the color of a standard classic Apex report column. I want the whole columns background color to be blue. I tried some of the suggestions for using span etc, but they did not work.
    Was wondering if anyone has a solution for this? would be very helpful!
    Thanks,
    Ryan

    Use a custom named column report template with <tt>&lt;colgroup&gt;/&lt;col&gt;</tt> and CSS as in these threads.
    Could also be done with JavaScript, but if the entire column is to be coloured (rather than individual cells based on some condition), the template approach will be simpler and have better performance

  • Interactive Report Column Headings and Row Height

    I am using the div style="width:350px;" method to control the width of columns in various interactive reports. That works fine except for the following:
    1. When creating filters, the <div...> stuff shows up along with the actual column heading, thus confusing some end users
    2. Even when I uncheck the "Use same text for single row view" checkbox and then provide a simple single row view label, the <div> stuff still shows up on the single row view
    Does anyone have a better solution?
    Also, does anyone know of a way to limit the row height within an interactive report row? I have some columns of data that contain a large amount of HTML data and I'd like to be able to limit the number of rows that show on the report.
    Is Oracle planning to provide some better control over the Interactive Report columns in another version? The Interactive Report is such a huge improvement in usability in APEX - it would be great to take it to another level by providing some better control over column width and row height.
    Edited by: DaleB on Jun 18, 2009 8:54 AM
    Edited by: DaleB on Jun 18, 2009 8:54 AM

    Dale,
    Unfortunately we don't have much we can use to do what you would like. I would have said it's impossible until version 4 but you could actually do something similar to what Roel has done. His trick is in the edit button. He changed the edit button to use an "onload" call to a JavaScript process. You could do the same but call a process that goes across the rows and styles each column. Now because you don't have a way to identify the column (can't use the order because the end user could change it) you'll have to write the code to look at the top row first and then style the appropriate column. As far as I can tell, this would be quite difficult and inefficient. Having said that if you need it that bad and would like some help with it, put up an example application on apex.oracle.com and provide the workspace/username/password and I'll take a look.
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen
    You can reward this reply by marking it as either Helpful or Correct ;-)

Maybe you are looking for

  • How to get all events from calendar using calcalendar store framework.

    Hello, I have two problems with calcalendar store framework programming. 1. I need all the event which are present in iCal calendar.Event may be present in year 2025 or 2050. and if the event is recurring then i need only one event. 2. if the event i

  • SBS 2011 Remote Web Workplace issues not enough memory???

    Hi, Were having problems with the RWW website on our SBS 2011 server, users are able to logon, but the connect buttons of the computers are not working, if we click on them nothing happes, no error message, nothing. When a users logs on we see 5 erro

  • Dynamic database connections at Runtime dbAdapter

    Hi I need to connect to a database defined a runtime in a BPEL process using the dbadapter. All the configuration parameters for making the connection are provided at runtime (connectionURL, User, Password) and i need a way to configure them in the d

  • Memory frequency different to FSB

    Hello, i have KT600, i can set the memory frequency different to FSB. what happens if my FSB runs at 200Mhz and my memory only at 166 mhz??? will there be much performance loss compared to 200/200 ? thank you. Oliver

  • Calculate excise duties based on rates in J1IEX

    Hi, When i am trying to change the duty rates  in J1IEX transaction (in change mode) and put tick in check box( Calculate excise duties based on rates ),then the system calculating wrong duty values for SHEcess & Ecess. We are using TAXINN here. Pls