Releases: noahsalvi/svelte-use-form
2.10.0 - New email validator that requires TLD
emailWithTLD
can now be used as an extension of email
which furthermore requires a valid TLD. (.com, .org, ...)
Thanks to @keehun
2.9.1 - Fix change method
Fixed a bug where the change
method of a form control wouldn't update $form
.
2.9.0 - Validators "control" parameter
Validators can now access the control / field that it was assigned to.
const newValidator: Validator = (value, form, control) => {
// Access `field`
};
The syntax may change in the next major release version 3 to for example concatenate form
and control
into an object.
This would allow further changes later down the line without causing breaking changes.
2.8.0 - Dynamic Validators
When using the validators
action, validators will now be "recreated" when the argument changes.
Example:
Iff you modify the parameter length
the validator is automatically recreated and applied to the input.
<script>
let length = 5;
</script>
<input name="username" use:validators={[minLength(length)]} >
2.6.0
- Multiple forms per component: Assign a name to a form by setting it in the constructor
useForm({}, "user-form")
and then assigning theform
attribute on theHintGroup
orHint
to it:<Hint form="user-form"…>
- Hint class and id: Hint component now exposes
class
andid
attributes.
Huge thanks to @moalamri! 🎉
2.6.1
since 2.6.0
had some breaking changes.
2.5.0
- Improve typings: Specifying controls in the constructor will lead to them being suggested when accessing
$form
#24 - Ignore attribute: We can now use
data-suf-ignore
to ignore a form control from being detected by svelte-use-form. #38 - New Regex pattern validator #41
- Newer svelte version: Updated project to newer svelte library skeleton
- Bug fixes and refactoring
2.4.0 - Reset Functions
$form.reset()
to reset the whole form.
$form.email.reset()
to reset for example the email field.
$form.email.reset({ value: "Set the value it should have after the reset })
You can also set the value manually, if omitted it will have the initial value of the field.