cancel
Showing results for 
Search instead for 
Did you mean: 

Error in retrieving value from the inputfield.

Former Member
0 Kudos

Hi Experts,

There is this behaviour I saw in WD which was understood by me.

Let me explain it :

I am doing a comparison scenario where I compare 2 products in a grid format.

For this I have a table with a various types of variants.

In this grid I have a inputfield which takes an integer input and based on which there is an effect on other variant field of that product.

Now I am retriving the value of the input field in the modify view through

input.getValue(); parse this string to an Integer and then pass it to the model.

Here is the problem everything works fine when the user goes and changes the value for the firsttime but if he does the same thing without the input field loosing focus it throws a Numberformat exception this occurs because the string value retrived this time is an empty string which obviously can't be parsed.

Can anyone explain me the why is it behaving in this way?

Any help will be truly appriciated.

Best Regards & Thanks in Advance

Amit

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

1. get the value of the input field through context attribute mapped to the input field.

2. In your input field is of type integer then map the input field to a context attribute of type integer.In this case the input field will be intialized to 0.

Former Member
0 Kudos

Hi Shriram,

This is obviously an option I am aware of I want to know why is the element behaving like this.

thankyou

Amit

Former Member
0 Kudos

Hi,

If u want to change the focus before retrieving the data from input field, try

IWDButton b=(IWDButton)view.getElement("Button");

b.requestFocus();

before

IWDInputField in1=(IWDInputField)view.getElement("InputField2");

int a=Integer.parseInt(in1.getValue());

Regards

Fahad Hamsa

Former Member
0 Kudos

Hi Fahad,

You are right once I change the focus things behave normally.But any idea why this problem occurs at the first place.Why am I not getting the updated values directly.

Regards

Amit

Former Member
0 Kudos

Hi Amit,

It was working for me without requestFocus(). The reason with ur application may be the difference in version

Regards

Fahad Hamsa

Former Member
0 Kudos

Hi Amit,

I hope you might have written any code <b>to empty the input field</b>. Chek it in your code, and place it in appropriate place(if any).

Regards,

Prabhakar.