Comments (9)
Start a new pull request in StackBlitz Codeflow.
from ant-design.
Can you tell me about your requirements? In fact, the trigger property is used to declare the timing of the component's value change, and Form.Item will convert its child components into a controlled mode. If you set onblur, during the first rendering, because the value is undefined, the component is still in an uncontrolled state at this point, so the input behavior can change the value. However, after an onblur event is triggered once, the value is no longer undefined, and the component is now controlled. It will attempt to change the value through the onblur event, which, of course, will not update correctly. Of course, if you want to trigger validation when onblur occurs, please refer to validateTrigger.
from ant-design.
Can you tell me about your requirements? In fact, the trigger property is used to declare the timing of the component's value change, and Form.Item will convert its child components into a controlled mode. If you set onblur, during the first rendering, because the value is undefined, the component is still in an uncontrolled state at this point, so the input behavior can change the value. However, after an onblur event is triggered once, the value is no longer undefined, and the component is now controlled. It will attempt to change the value through the onblur event, which, of course, will not update correctly. Of course, if you want to trigger validation when onblur occurs, please refer to validateTrigger.
I need to send the value of the input field after onBlur
There is a form, somewhere there is a delay in sending data after entering, and somewhere I need to send data only when onBlur is triggered, and it turns out that after entering values I can no update the field
Also in my example on stackblitz note that input: number with onBlur, everything works fine, why is that?
from ant-design.
trigger
means the value which will Form.Item to collect.
- At the first time, the field value is
undefined
. So Input will work as uncontrolled component. - When
onBlur
, thevalue
is set to what user input. The Input will be the controlled component. So any type will not work.
You should not use trigger
for validation. But use validateTrigger
instead.
from ant-design.
Also in my example on stackblitz note that input: number with onBlur, everything works fine, why is that?
Input follow the behavior as native input element since every time the input is what input validate value. But InputNumber has the flying status. e.g. 1.2
type 1.
, the 1.
is not validate number. If it force as controlled, user will never successfully type the 1.2
. So it will keep tracking typing status.
So if you want to follow the InputNumber behavior. You can HOC Input component to make focus not be controlled.
from ant-design.
Also in my example on stackblitz note that input: number with onBlur, everything works fine, why is that?
Input follow the behavior as native input element since every time the input is what input validate value. But InputNumber has the flying status. e.g.
1.2
type1.
, the1.
is not validate number. If it force as controlled, user will never successfully type the1.2
. So it will keep tracking typing status.So if you want to follow the InputNumber behavior. You can HOC Input component to make focus not be controlled.
again I need to get value in
<Form form={form} onValuesChange={debounceHandler}>
using
Form.Item with trigger="onBlur"
and whether input or textarea
Please give me an example where this would work
from ant-design.
again I need to get value in
<Form form={form} onValuesChange={debounceHandler}>
usingForm.Item with trigger="onBlur"
and whether input or textarea
Please give me an example where this would work
If you need to perform some operations ononBlur
, you can do it like this, but please make sure that the antd component you are using can accept theonBlur
property.
from ant-design.
onBlur
I need onValuesChange to only work when onBlur is enabled.
your example still fires onValuesChange during input
from ant-design.
It feels a bit difficult to handle, as the form component triggers onValuesChange every time updateValue is called.
from ant-design.
Related Issues (20)
- After entering a value, the Form.List component switches to the next input component in the List to start inputting, and the value entered by the previous component will become empty HOT 2
- RangePicker resetting selected date on press enter HOT 2
- Slider组件拖动时不松开鼠标移动到禁用状态的按钮上放开,鼠标移动依然还可以控制Slide位置 HOT 5
- antd4.24.16Select组件手动将 value 设置为 null,select 应该显示placeholder,但是页面渲染没有改变 HOT 1
- Modal框关闭按钮问题 HOT 3
- DirectoryTree组件titleRender中渲染modal无法关闭 HOT 4
- Head table title columns blink when use sticky and sorter with useEffect react 18 to set columns HOT 1
- Drawer 组件我部署后生成的css自带了jdk的路径地址 HOT 5
- Click propagation on table rows when a modal is clicked
- DatePicker onChange doesn't work for dates on lower edge of disabledDate HOT 1
- CSS Compatible seems to be different in local and in production HOT 1
- menu horizontal 菜单一级菜 key为空字符“” 会一直选中默认选中 HOT 6
- Gap Between Tooltip Content and Arrow When Page is Zoomed HOT 2
- 静态调用message/Modal无法降级:where HOT 4
- Typography.paragraph can't display tooltip HOT 3
- Form.List唯一性校验 HOT 2
- TextArea showCount 和 extra 文字覆盖显示 HOT 2
- rate组件能否禁用键盘默认事件 HOT 1
- Tour组件onClose回调方法current值有误,以及steps多步骤里面的onClose始终调用第一个step的
- Ant Table Sort not working with null values HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ant-design.