cancel
Showing results for 
Search instead for 
Did you mean: 

Interactive Form - How to make fields read-only through the code?

Former Member
0 Kudos

Simple question but i can't seem to figure out how to do it. I have an interactive form that have editable fields. How do I toggle fields to make some of them read-only through the code. Please provide cold sample. thanks a lot.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

mick,

How did u make ur form an interactive one????

PLs help..

Thanks,

Sunny

Former Member
0 Kudos

Hi mick,

i think, based on ur certain conditions; u want to make some fields read only, .

For this, implement the following code in the wdDoModifyView() method of that view:

if ( ) <b>///ur condition</b>

IWDInputField a = (IWDInputField)view.getElement("<b> FieldName </b>");

a.setEnabled ( false ) <b>;///// this will make the field unable.</b>

u can make them able or unable just by changing the boolean value inside <u><b>setEnabled( )</b></u> try this.hope it will work.

Former Member
0 Kudos

Hi Mick,

Instead of doing the read only property in the code,when u bind ur context to the input field set the cont.att type read only to true for the fields that u don want to edit.

Hope this helps u,

Regards,

Nagarajan.

Former Member
0 Kudos

<b>Nagarajan Kumarappan:</b>

I know how to do that but that's setting the value at design time. Mine has to be done at runtime(when the page loads) because there are a lot of condidtions determining which fields should be and should not be readonly. therefore I have to do in the code. Any by saying code I mean Java not java script or formcal.

<b>kushagra mittal:</b>

are you talking about regular webdynpro input fields? I am asking for that. I am talking about input fields inside my adobe interactive form embedded on the webdynpro page.

I think what needs to be done is to disable context attributes like Nagarajan Kumarappan suggested but do that through Java which I don't see any tutorials show that.

still looking for help.

Former Member
0 Kudos

Hi,

To set the context attribute to read only , try this following..

IWDAttributeInfo atrinfo = wdContext.getNodeInfo().getAttribute("atr name");
  	atrinfo.getModifiableSimpleType().setReadOnly(true);

Regards

Bharathwaj

Former Member
0 Kudos

awesome! looks promising but i won't get to try until monday. thanks. will let u know the result.

Former Member
0 Kudos

Hello,

in order to make the fields read only in my interactive form I inserted the coding described above to my web dynpro application.

Result: my fields are NOT read-only.

Any idea how it should work? Thanks a lot.

Marita

Former Member
0 Kudos