cancel
Showing results for 
Search instead for 
Did you mean: 

Disable InputField during Runtime

Former Member
0 Kudos

Hi,

I have created a Model and filling up a table of 12 column with some data. I am using 7 Inputfields and 5 textviews in a row. Now the problem am facing is that <b>I want to disable some InputFields in a row (not column wise).</b> I am able to disable the UI element columnwise but that doesn't solve my problem.

So can anybody suggest solution to disable a particular cell in a row containing inputfield during runtime?

Regards,

Vaibhav

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

do the following steps

--> first take value attribute under your model node and set the type of that value attribute as boolean

--> set the enabled property of the table cell that u want to make disable to this value attribute

--> after u got data for the model node( i,e after ececute() method )

--> use loop to set each row cell to make disable or enable

for(int i=0;i<wdcontent.node<nodename>.size'i++)

{

wdcontext.current<nodename>Element.set<valueAttribut>(true/false);

// set true/false according to ur requirement

}

--> if u want to make two or more number of inuputfields as disable/enable then use that much number of value attributes under the model node ( for each inputfield on value attribute )

Former Member
0 Kudos

Hi siva,

Tried the thing suggested by you. Am still not able to disable/enable particular Inputfield in a column.

Former Member
0 Kudos
ModelNode
+ State (value node, card=1:1, selection=1:1, singleton=false)
---- IsReadOnly (attribute, boolean)

To set row at index i to read-only, bind InputField (table cell editor) "readOnly" property to attribute "IsReadOnly".

Set value of attribute in row i to true:

IModelNodeElement e = wdContext.nodeModelNode().getModelNodeElementAt(i);
e.currentStateElement().setIsReadOnly(true);

or declare attribute "IsReadOnly" as calculated and return value from generated get-method.

Armin

Former Member
0 Kudos

Hi Armin,

Thanks a lot for your suggestion.

I created a modelnode named as ModelNode and then State Vale node and then IsReadOnly attribute. But am not able to get IModelNodeElement.

Can you please mention the properties of model node and also please elaborate "<b>declare attribute "IsReadOnly" as calculated and return value from generated get-method.</b>

"

Former Member
0 Kudos

The "ModelNode" stands for an existing node mapped to the model. No need to create it in the view controller.

The calculated attribute is an alternative way for your scenario, try the other way first.

Armin

Answers (4)

Answers (4)

monalisa_biswal
Contributor
0 Kudos

1>Create a value attribute of type boolean under table source node with calculated property set as true.Bind readOnly property of table cell editor to this value attribute

2>In the getter method of value attribute compare value of the field and set it accordingly.

Former Member
0 Kudos

Hi ,

go thru this may be this will help you.

I have used fill the Textview in a table with different color in run time.

Regards

Manoj

Message was edited by:

Manoj Sahoo

Former Member
0 Kudos

Hi,

Create a boolean variable say "flag".

set readOnly properties to "false".

now go to InputFields and set "Readonly" properties to that boolean variable.

Now in run time you can write conditional statement to make them readonly or disabled.

like:

<b>for disable</b>

wdContext.currentContextElement().setflag(True);

<b>for enable</b>

wdContext.currentContextElement().setflag(false);

Thanks

Manoj

<b>Note: If helpful give reward points.</b>

former_member188556
Active Contributor
0 Kudos

Hi Vaibhav

U r using a loop to add elements to the table rt?

u can do some "if" condition in that to achieve this.

First, the inputFields enabled property should be mapped to a context variable of type boolean. Then in the loop assign this variable true or false according to the conditions.

If u can paste the code snippet of that loop, i can give u a working code sample,

Regards

BP

Award points if found usefull

Former Member
0 Kudos

Hi Bp,

Thanks a lot for your fast reply. I am using Model to fill the table. So there is no need of using a loop to fill the table.

Earlier I tried creating a boolean type context variable and assigned it to TableCellEditor (InputField) enable properyty, but it will disable or enable the whole column which I don't want to happen. I want a cell of a particular row to get disable/enable.

Regards,

Vaibhav

former_member188556
Active Contributor
0 Kudos

Then i think u need to use a loop o acheive this.

Or else send me more info abt how ur application fetches data and displays in the table.

Regards

BP

Former Member
0 Kudos

I have created custom controller for model created

<b> public void executeZFunction_Input( )

{

//@@begin executeZFunction_Input()

//$$begin Service Controller(-213575660)

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try{

wdContext.currentZFunction_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

} catch(WDDynamicRFCExecuteException ce) {

manager.reportException(ce.getMessage(), false);

}</b>

In view following method fills the table:

<b> public void wdDoInit()

{

//@@begin wdDoInit()

wdThis.wdGetMCustController().executeZFunction_Input();

//@@end

}</b>