Reputation: 3516
I have a apex report that has many rows with various data type. Now the user wants to view each row in detail. For this they want it to be in a form view.
But the form view must be conditionally read only (so that the user can not change anything if he does not have privilege).
I have found that , the interactive report of oracle generates a similar view for "single row view" ( although it is not conditionally editable).
In Another word, I want to show the row of a report by pivoting column to row.
Please help me how to do it.
(Creating a new form view and then make each element read only is a option , but it has many problem and is not suitable for over 50 reports.)
Thanks in advance for your help.
Upvotes: 2
Views: 5172
Reputation: 7028
I'd say your only option is to create the form pages, especially when you want editing. IR's don't have that kind of functionality built-in, and if you were to try and give them it through the apex_item
API, you'd still have to write custom processes.
It would have been fastest to create the report+form combo upon creation (select form for new page, then form with report).
Now you'd have to select the query for your IR, and use this as a basis for your form query.
To make your items conditionally read-only, you can use the read-only condition on the items. If you use a plsql function returning boolean
, you can even test an authorization scheme through apex_util.public_check_authorization
(doc: APEX_UTIL)
And other than this route being grievously annoying and time-consuming, i don't know of these 'many problems' with it.
Now, if your form has to be conditionally read-only as a whole and not just certain items, you can solve it in other ways aswell.
For both you'll have to create the form pages: there is no way around this, and is the fastest and easiest.
conditional javascript+conditional process on form pages:
dynamic action, fire on page load. Execute javascript:
$('input').prop('readonly', true);
This will set all input items as readonly.
By using CSS you can make this clear to your users, for example
input[readonly]{ background-color: grey; }
They'll still be able to navigate and see a cursor, but won't be able to directly edit. Of course, javascript is not enough. Someone can still alter values through using a tool like firebug or ie developer tools. To stop that, change the conditions and/or authorization checks on both your dynamic action (only fire when user has no rights) and your record processing process (only run when user has rights). When a user has no rights, and manages to alter values and submit them, nothing will be sent to the database.
conditional link + form page:
Upvotes: 2