Skip to content

Commit

Permalink
Merge pull request #255 from navikt/Unngår-feilmelding-ved-desimaler-…
Browse files Browse the repository at this point in the history
…eller-bokstaver-i-feltet

Unngår feilmelding ved innsending med desimaler eller bokstaver i feltet
  • Loading branch information
olsenrasmus authored Oct 8, 2024
2 parents 4ab3459 + 63a413d commit 0915b41
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions force-app/main/default/lwc/hot_claimForm/hot_claimForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,21 @@ export default class Hot_claimForm extends LightningElement {
}
validateOrgExpenses() {
let hasErrors = false;
const numberOnlyRegex = /^\d+$/;

this.template.querySelectorAll('[data-id="orgExpenses"]').forEach((element) => {
if (element.value === '') {
element.sendErrorMessage('Utgifter må fylles ut');
hasErrors = true;
} else if (!numberOnlyRegex.test(element.value)) {
element.sendErrorMessage('Kun hele tall er tillatt');
hasErrors = true;
}
});

return hasErrors;
}

showErrorOrgNumber() {
let hasErrors = false;
this.template.querySelectorAll('[data-id="orgNumber"]').forEach((element) => {
Expand Down

0 comments on commit 0915b41

Please sign in to comment.