cancel
Showing results for 
Search instead for 
Did you mean: 

action parameter for inputfield

Ronib
Participant
0 Kudos

hi

i'm trying to get the value of an input field after the user hit enter.

i tried <i> input1.mappingOfOnEnter().addParameter("value",input1.getValue()); </i>

but got just the previous value of the field.

it also seems that i cant pass the whole element to the action with

<i>input1.mappingOfOnEnter().addSourceMapping().("nodeElement","nodeElement");</i> because it passes only null to the action

whats the way to do that ?

thanks

Roni

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Roni,

You misinterpred the purpose of action parameters mapping.

However, in your cas it's note necessary at all, you may just use context:

wdContext.current<NameOfNode>Element().get<MyAttr>();

where <NameOfNode>.<MyAttr> is attribute of context node to wich InputField.value property is bound to.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Ronib
Participant
0 Kudos

but Armin,

in one of the wd tutorial (tree example) we map a whole element as a parameter

every time the user clicks a level in the tree we pass the selected element

i want to do that in input field ui element.

Former Member
0 Kudos

The meaning of the implicit "nodeElement" event parameter is differently: It gives you the node element representing a table row or tree node if the UI element is used as a table cell editor or tree node editor.

If your InputField is a table cell editor, mapping "nodeElement" event parameter to an action parameter would allow to get the table row in the action handler.

If not, the parameter contains a NULL value.

Armin

Ronib
Participant
0 Kudos

I solved the problem on my own:

I have inputField that bound to context <i>wdContext.OutputCloth.Pants_size</i>

When i passed it as a parameter to action i get null (i guess because of the wd phase model). So i passed the inputField.bindingOfValue (contains the name of the attribute : <i>wdContext.OutputCloth.Pants_size</i> and in the action i use

wdContext.getChildNode("OutputCloth",0).getCurrentElement().getAttributeAsText("Pants_size") to get my desired value.

Former Member
0 Kudos

Roni,

<i>wdContext.getChildNode("OutputCloth",0).getCurrentElement().getAttributeAsText("Pants_size")</i>

I bet the following alternative is more readable and type-safe:

wdContext.currentOutputClothElement().getPants_size()

VS

Ronib
Participant
0 Kudos

Valery,

i double checked it on my application :

<i>wdContext.currentOutputClothElement().getPants_size()</i> returns null

<i>wdContext.getChildNode("OutputCloth",0).getCurrentElement().getAttributeAsText("Pants_size")</i> returns the value on the inputField.

that is in a method called from onActionSomething

thanks for your attention!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Roni,

what you can do is, create a context n then bind it to the input field and then in the action collect the value of the context in some variable and then you can check the value of theat variable.

Jeet

Ronib
Participant
0 Kudos

passing the Context attribute from modifyView() passes the old value

and not the new value that the user enter before he hit enter (and that is logical),

if i press enter twice i get my desired value (and that is logical).