Read-only fields on APEX tabular form except on a new row

I was asked by our APEX developer whether or not some fields of the tabular form created by wizard, except on a new row when “Add Row” is clicked, can be made read-only. This is a part of business requirements that the existing parameters should not be modified by end users.

I started searching for the existing solutions and found that most call for using the manually-created tabular form. However, one comment from this forum post suggested Javascript to perform task. Even though there was no code given, I’d like explore this option.

With information from Denes Kubieck’s Demo application and Patrick Wolf’s post on “Which Tabular Form Column is mapped to which Apex_Application.g_fxx array?”, this is the sample of my simple solution which uses Javascript to make fields read-only.

Please note that in this sample application, there are other things I included to show our developers. I added a page-level validation to ensure that there is no duplication in a selected field entry. Even though there is an unique constraint on this column, by using validation, it is more informative to users. The pop-up help reminds users that the field is protected and no duplication is allowed.

17 thoughts on “Read-only fields on APEX tabular form except on a new row”

  1. Hi,

    Your java script works fine for text-item,
    for LOVs is required use
    $x(curr_id).disabled = true;

    instead of

    $x(curr_id).readOnly = “readonly”;
    $x(curr_id).style.background = “silver”;

    Now I’ve a problem with tabular “simple checkbox”, even if i use javascript to disable checkbox and make it read-only
    it doesn’t work.

    Any Idea??
    Thanks
    Giuseppe.

    1. Giuseppe,

      I did try disabled on the check box. It works for me. Have you tried something like this? I put this function on on_load.

      function disable_chkbox()
      {
      x = document.getElementById(‘P2_CHKBOX’);
      x.disabled = true;
      }

      1. Ittichai,

        In my case the checkbox is one of the columns of a
        Wizard TABULAR FORM.

        Report Attributes>Column Attributes>Display As=Simple Checjbox.

        Should be a jQuery object, looking with FireBug:

        In this case the command:
        $x(curr_id11).disabled = true;
        dosen’t work, maybe should be used a jQuery command.

        Thxs.
        Giuseppe.

  2. Hi,

    My Requirement is “Read-only fields on APEX tabular form except on a new row”.
    Please tell me all the steps from starting as how I can make all rows in tabular form as read only except for the new row.
    Its very urgent since today is my dead line.

    Regards,
    Samiya

      1. Thanks for your reply Ittichai but I don’t see any link in the post where I can actually see a working application.

  3. All,

    For the Simple chexbox in the tabular form if the Item is
    f10 use the following

    var curr_id10 = document.wwv_flow.f10.id + “_01”;
    //disable column Checkbox $x(curr_id10).disabled = true;

    Note that checkbox in the tabular is referenced with “_01” as suffix.

    1. Thanks for you reply Giuseppe…I have a row selector a row selector, ACCT_REVIEW_ID and ACCT_REVIEW_ID_DISPLAY.
      Now how will put the condition to make only current row updatable/editable.
      Remaining rows should become read-only

    2. Can you please tell me how to does this code work to disable others rows except current row:

      For the Simple chexbox in the tabular form if the Item is
      f10 use the following

      var curr_id10 = document.wwv_flow.f10.id + “_01″;
      //disable column Checkbox $x(curr_id10).disabled = true;

      Note that checkbox in the tabular is referenced with “_01″ as suffix.

        1. Can you please paste the link in your reply…I don’t know why I am not able to see it in above 10 posts…

  4. Thanks Ittichai…Can you please tell me how do I modify the code if I have to make specific row read only instead of a column?

    For example except for current row how do I make other rows read only?

  5. In java script use the following
    $($x(curr_id)).datepicker( “disable” );
    where curr_id is the TABULAR rownum.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top