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)