Add onInput method to form API

pull/6632/head
Mert Sincan 2024-10-22 15:07:25 +01:00
parent c71ea19850
commit 9f8003ad9d
1 changed files with 3 additions and 0 deletions

View File

@ -38,6 +38,9 @@ export const useForm = (options = {}) => {
states[field].touched = true; states[field].touched = true;
(fieldOptions?.validateOnBlur ?? isFieldValidate(field, options.validateOnBlur)) && validate(field); (fieldOptions?.validateOnBlur ?? isFieldValidate(field, options.validateOnBlur)) && validate(field);
}, },
onInput: (event) => {
states[field].value = event.hasOwnProperty('value') ? event.value : event.target.value;
},
onChange: (event) => { onChange: (event) => {
states[field].value = event.hasOwnProperty('value') ? event.value : event.target.type === 'checkbox' || event.target.type === 'radio' ? event.target.checked : event.target.value; states[field].value = event.hasOwnProperty('value') ? event.value : event.target.type === 'checkbox' || event.target.type === 'radio' ? event.target.checked : event.target.value;
}, },