APEXblog.nl - Tips and Tricks

About This Blog:
I (Richard Weug) started this blog primary for myself to save all kinds of Apex tips and tricks in one place. To use it as a place to write down how I used some coding in my own projects, but also to copy and paste all kinds of articles I find on the Internet. (So I never have to wonder on what website did I read about??? When I see something interesting I collect the content so I have my own archive/knowlegde base.

View my profile on LinkedIn

 

Tips & Tricks

Print
18
Mar

Easy way to make items read-only

Written by Richard Weug. Posted in Tips and Tricks

I just came across things when apex page have different types of item and if we want to keep that element for read-only purpose, in type of form element like text box we can do it easily using its own property readonly="readonly" but in case of select list ?  so following is a common method which works for both select list as well a text box, it may be run for other form element too but I have not tested it.


Method:

Step 1: enter "HTML Form Element Attributes" value to " disable="disable" " in the apex all your apex page item, eg P1_TYPE which is a select list type

Step 2: create one dynamic action with following parameters
Event = Before Page Submit
Create true action with following parameters
Action = Execute JavaScript Code
Code = $("#P1_TYPE").removeAttr("disabled");

How does it work....
while the page gets loads it make the apex item disable, as we all know if we disable any apex item the value of that item will not be submit so we any how need an enable item, so on before page submit we write that the apex item should remove the disabled attribute.  so it will work.

Original article by: Jaydip Bosamiya - http://jbosamiya.blogspot.com/2011/03/easy-way-to-make-apex-items-readonly.html