Skip to content
Snippets Groups Projects

Validation create saving goal

Merged Agnethe Kval-Engstad requested to merge validation-create-saving-goal into development
1 file
+ 13
1
Compare changes
  • Side-by-side
  • Inline
@@ -88,6 +88,18 @@ const cancel = () => {
router.push('/dashboard');
}
/**
* Handles input event to sanitize the amount input value.
* Removes special characters from the input value.
*
*/
const handleAmountInput = (event) => {
const charactersToIgnore = /[,.:;<>+?/\\&%$#"!'´*\[\](){}\-=^¨@§]/g;
let value = event.target.value;
value = value.replace(charactersToIgnore, '');
event.target.value = value;
}
</script>
<template>
@@ -111,7 +123,7 @@ const cancel = () => {
<FormItem>
<FormLabel>Hvor mye vil du spare (NOK)? </FormLabel>
<FormControl>
<Input placeholder="15 000" v-bind="componentField" class="border-2 border-primary hover:border-darkest" />
<Input placeholder="15 000" @input="handleAmountInput" v-bind="componentField" class="border-2 border-primary hover:border-darkest" />
</FormControl>
<FormMessage />
</FormItem>
Loading