diff --git a/components/Forms/Signup/index.tsx b/components/Forms/Signup/index.tsx index 9d89456fb..a8d05d335 100644 --- a/components/Forms/Signup/index.tsx +++ b/components/Forms/Signup/index.tsx @@ -79,6 +79,17 @@ export default function SignupForm({ link, subtitle, title }: SignUpFormProps) { signup.mutate({ ...data, language: lang }) } + async function handleValidation() { + const result = await methods.trigger() + if (!result) { + // Get first error field and focus on it. + const firstError = Object.keys(methods.formState.errors)[0] + if (firstError) { + methods.setFocus(firstError as keyof SignUpSchema) + } + } + } + return (
{title} @@ -190,7 +201,7 @@ export default function SignupForm({ link, subtitle, title }: SignUpFormProps) { type="button" theme="base" intent="primary" - onClick={() => methods.trigger()} + onClick={handleValidation} data-testid="trigger-validation" > {signupButtonText} diff --git a/i18n/dictionaries/da.json b/i18n/dictionaries/da.json index 6fa96b8f1..3acc7ad46 100644 --- a/i18n/dictionaries/da.json +++ b/i18n/dictionaries/da.json @@ -406,7 +406,6 @@ "Which room class suits you the best?": "Hvilken rumklasse passer bedst til dig", "Year": "År", "Yes": "Ja", - "Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Ja, jeg accepterer vilkårene for Scandic Friends og forstår, at Scandic vil behandle mine personlige oplysninger i henhold til", "Yes, discard changes": "Ja, kasser ændringer", "Yes, remove my card": "Ja, fjern mit kort", "You can always change your mind later and add breakfast at the hotel.": "Du kan altid ombestemme dig senere og tilføje morgenmad på hotellet.", diff --git a/i18n/dictionaries/de.json b/i18n/dictionaries/de.json index 433954331..8c4a26459 100644 --- a/i18n/dictionaries/de.json +++ b/i18n/dictionaries/de.json @@ -405,7 +405,6 @@ "Which room class suits you the best?": "Welche Zimmerklasse passt am besten zu Ihnen?", "Year": "Jahr", "Yes": "Ja", - "Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Ja, ich akzeptiere die Geschäftsbedingungen für Scandic Friends und erkenne an, dass Scandic meine persönlichen Daten in Übereinstimmung mit", "Yes, discard changes": "Ja, Änderungen verwerfen", "Yes, remove my card": "Ja, meine Karte entfernen", "You can always change your mind later and add breakfast at the hotel.": "Sie können es sich später jederzeit anders überlegen und das Frühstück im Hotel hinzufügen.", diff --git a/i18n/dictionaries/fi.json b/i18n/dictionaries/fi.json index 007d0b968..4f6965532 100644 --- a/i18n/dictionaries/fi.json +++ b/i18n/dictionaries/fi.json @@ -406,7 +406,6 @@ "Which room class suits you the best?": "Mikä huoneluokka sopii sinulle parhaiten?", "Year": "Vuosi", "Yes": "Kyllä", - "Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Kyllä, hyväksyn Scandic Friends -käyttöehdot ja ymmärrän, että Scandic käsittelee minun henkilötietoni asianmukaisesti", "Yes, discard changes": "Kyllä, hylkää muutokset", "Yes, remove my card": "Kyllä, poista korttini", "You can always change your mind later and add breakfast at the hotel.": "Voit aina muuttaa mieltäsi myöhemmin ja lisätä aamiaisen hotelliin.", diff --git a/i18n/dictionaries/no.json b/i18n/dictionaries/no.json index 7b5a568a6..5494b85ef 100644 --- a/i18n/dictionaries/no.json +++ b/i18n/dictionaries/no.json @@ -403,7 +403,6 @@ "Which room class suits you the best?": "Hvilken romklasse passer deg best?", "Year": "År", "Yes": "Ja", - "Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Ja, jeg aksepterer vilkårene for Scandic Friends og forstår at Scandic vil behandle mine personlige opplysninger i henhold til", "Yes, discard changes": "Ja, forkast endringer", "Yes, remove my card": "Ja, fjern kortet mitt", "You can always change your mind later and add breakfast at the hotel.": "Du kan alltid ombestemme deg senere og legge til frokost på hotellet.", diff --git a/i18n/dictionaries/sv.json b/i18n/dictionaries/sv.json index 9bf840a18..e651b14d6 100644 --- a/i18n/dictionaries/sv.json +++ b/i18n/dictionaries/sv.json @@ -403,7 +403,6 @@ "Which room class suits you the best?": "Vilken rumsklass passar dig bäst?", "Year": "År", "Yes": "Ja", - "Yes, I accept the Terms and conditions for Scandic Friends and understand that Scandic will process my personal data in accordance with": "Ja, jag accepterar villkoren för Scandic Friends och förstår att Scandic kommer att bearbeta mina personliga uppgifter i enlighet med", "Yes, discard changes": "Ja, ignorera ändringar", "Yes, remove my card": "Ja, ta bort mitt kort", "You can always change your mind later and add breakfast at the hotel.": "Du kan alltid ändra dig senare och lägga till frukost på hotellet.",