This discussion is archived
2 Replies Latest reply: Jan 14, 2013 5:28 AM by Joni Vandenberghe RSS

Readonly cell in tabular form

Cashy Newbie
Currently Being Moderated
Hi Guys,

I have a tabular form with a cell that I want to make readonly if a text item (P10_INVENTORY_ITEM_ID) is not null.

I have the following code which I just cant seem to get working
<script language="javascript" type="text/javascript">
function make_existing_column_readonly()
{ 
   var vinv =  document.getElementById('P10_INVENTORY_ITEM_ID');
   //var vinv =  '123';

    var l = vinv.length;
      if (l > 0) { // has a value
          var curr_id = document.wwv_flow.f10.id;
          $x(curr_id).readOnly = "readonly";
          $x(curr_id).style.background = "FFFF99";
                 }
}
</script>
If I uncomment the line var vinv =  '123'; and comment out var vinv =  document.getElementById('P10_INVENTORY_ITEM_ID'); the code works as expected.

As :P10_INVENTORY_ITEM_ID has a value when I running the test, it should make the cell readonly. I'm pretty sure that the value of P10_INVENTORY_ITEM_ID is not getting into the variable vinv.

Any advice would be great.

Thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points