3

I have one input field type number

<lightning:input type="number" aura:id="userId" name="userId" label="User Id" 
value="{!v.MyUser.userid__c}"  required="true" maxlength="10"/>

After my operation I need to reset the input field.So I am resetting the object field

component.set("v.MyUser", 
                {'sobjectType': 'Myuser__c',
                     'Name': '',
                     'userid__c': 0
                });

The field value is initialized to 0. But I need to clear the field.

I have tried

component.find("userId").set('v.value','');

also, but once I click the field it get reset, otheriwse it still displays the old value.

1
  • I am facing the same problem, somehow the ui does not refresh with the new value Commented Nov 13, 2016 at 8:34

1 Answer 1

2

We ran into the same issue and what we did was put the number field inside an aura if and used an attribute to hide and show it again and it became blank. Since aura-if removes the element from the dom and when rendering it again it recreates it so the field appears blank again.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.