You need to sign in to do that
Don't have an account?
Kon Dele
How to diplay apex:inputField as readonly on edit page
Hely yall,
We have a custom VF QuoteLineItem page that automatically calculates Total price based on Discount and Unit Price entered. Is there a way to lock down the UnitPrice field so that it's only editable by certain profiles? It's an editable apex:inputField. I've tried using an outputField, which displays the UnitPrice but can no longer calculate the Total price. Here's a screenshot and code snippet.
We have a custom VF QuoteLineItem page that automatically calculates Total price based on Discount and Unit Price entered. Is there a way to lock down the UnitPrice field so that it's only editable by certain profiles? It's an editable apex:inputField. I've tried using an outputField, which displays the UnitPrice but can no longer calculate the Total price. Here's a screenshot and code snippet.
<apex:inputField value="{!item.Item.UnitPrice}" rendered="{!IF(($Profile.Name =='System Administrator'), true , false)}"/>
Since the condition that you have to change its the disable status I think the best way to go its Javascript + Jquery. You might need to add jquery as an static resource or enable the remote site for google apis so you can include that script.
I am assuming you can have a table with several rows.
Then you can do something like this:
on the top of the pages add this:
if you don't have a table of field change the JavaScript to a single result:
Then you need to add a class selector your field (you can do this by Id but it can get complex), this way you can find all fields with the same selector.
Please give it a try and let me know how it goes.
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
All Answers
A couple of different one, you should be able to do math inside of the field. For example, I did the following
Or, if you did want to do it by a profile, you could use a lookup, and then an if statement within the field
For that to work of course you would need to pull over the user profile, and use the if statement against it.
Since the condition that you have to change its the disable status I think the best way to go its Javascript + Jquery. You might need to add jquery as an static resource or enable the remote site for google apis so you can include that script.
I am assuming you can have a table with several rows.
Then you can do something like this:
on the top of the pages add this:
if you don't have a table of field change the JavaScript to a single result:
Then you need to add a class selector your field (you can do this by Id but it can get complex), this way you can find all fields with the same selector.
Please give it a try and let me know how it goes.
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.