[Bug-16559] Perspective Numeric Entry Field displays oldValue when I move across the component via keyboard tab key or if validation fails by entering exponential character 'e' and lose focus

Hi,

I’m not sure if this is a bug or this has been addressed before.
When I use keyboard tab key to move across components, numeric entry field brings back oldValue (last entered value) on it.
Same happens when I enter exponential character ‘e’ and lose focus, self validation works but oldValue is displayed on it.

Hope my explanation is clear.

Thanks.

The Numeric Entry Field always has the true value stored in its properties. If you see a different value displayed, this is the formatted value, which is based on the format you supply in the properties. When the Numeric Entry Field receives focus, we provide the true value for editing because that is what the user should be editing - not the formatted value. Once focus is lost, we should then display the formatted value once more.

Is this what you’re seeing?

Hi @cmallonee,

Thanks for prompt response.

No, it is not about formatted value because format props is set to None in my case.
Let me give another example:
I have numeric entry field, its value props expression binding as attached.

When I select a table row, the cell value is displayed on numeric entry field.

When I create a new item in table, New ITEM button script makes will set the table selection to None and numeric entry field value to None.

Now when I enter character ‘e’ via keyboard and lose focus, it will return past table cell value.

Same happens when I move between component using tab key.

Sorry many pics attached to explain.

Attached pic for tab key case.
Red highlighted numeric entry field were empty (None) when opened the view.
I didn’t enter any value on red circled numeric entry fields, whereas just moved to next components using tab key.
But the last entered value displayed. This becomes wrong input, if user didn’t notice and correct it.

I suspect this might have something to do with how you’re “clearing” the value of the Numeric Entry Field. We don’t want to supply a default value when you drop the Numeric Entry Field, so we leave it blank. From this point onward, the NEF does not like blank values, or null values, or invalid values, and will instead fall back to the previous valid value.

So when you set the NEF to have a value of none or null, it’s really just in a quasi-errored state, waiting for a valid value. When you supply a valid character which would be part of a valid value but which is not in itself a valid value and then leave the NEF, the NEF falls back to the previous valid value.

I’ll reach out to dev to see if they consider this to truly be a bug, but what I would recommend in the meantime is that you do not “clear” the NEF with null or None or ''. In the event you need to clear an NEF, it should be supplied a value it can use.

Noted with thanks.

Unfortunately, only other choice now is to make it zero (0) which it can use. But this goes wrong since we do not want to see zero where the QC test was not performed. We truly want it to be a blank field!

Any other workaround for now?

There’s no other workaround for now, other than making sure that you only supply valid values into the Numeric Entry Field after it has been “cleared” with None, null, or ''.

Noted. Let me see how to live with it.
Hope we get some workaround in future.

Thanks.

After speaking with a developer we decided to open a bug to address this issue.

Noted. Thanks.

I still face issue with numeric entry field. Related to same bug I guess.

Though it doesnt display the oldValue, somehow when I run a query to update a database, if I clear a numeric entry field it inserts a 0 value to DB. it doesn’t insert null value to DB.

And looking at the attached image, the value in numberic entry field is cleared but on the script transform, the value > 0 is true!

The value is not None or null, it is an empty String. In Jython (not Python OR Java), an empty string is greater than 0.
Screen Shot 2020-07-26 at 8.54.39 AM
Consider including a check for the empty string before committing changes.

if (value > 0) and (len(str(value)) > 0):
    # do something