question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sign up form validation not working with "required" formField

See original GitHub issue

Describe the bug

In the sign up form, “required” fields are only considered for email, username and password. The form does not catch any incomplete fields that have been set to “required”.

To Reproduce Steps to reproduce the behavior:

In Vue, create a sign up form from <amplify-sign-up> component and add some required formFields. Then you can still sign-up without filling in those required fields.

Expected behavior We should get a notification mentioning that those fields are required

Code Snippet

<template>
  <amplify-authenticator username-alias="email">
    <amplify-sign-up
      slot="sign-up"
      username-alias="email"
      :form-fields.prop="formFields"
    />
  </amplify-authenticator>
</template>

<script>
export default {
  data() {
    return {
      formFields: [
        {
          type: 'email',
          required: true,
        },
        {
          type: 'given_name',
          label: 'First Name *',
          placeholder: 'Enter your first name',
          required: true,
        },
        {
          type: 'password',
          required: true,
        },
        {
          type: 'phone_number',
          required: true,
        },
      ],
    }
  },
}
</script>

Screenshots

We can create an account without filling in “First name” and “Phone Number”, which are required fields.

image

Once, I got a message saying that given_name was required but it never happened again…

Additional information

I see there is a validationData parameter which appears to be empty. I assume it should be completed based on these required parameters. It would be nice to also explain how to use it for more complex scenarios.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
ironspur5commented, Mar 30, 2021

Any updated on enforcing the required flag? I have custom attributes defined in form fields on sign up, and have set them to be required. Yet, I am able to sign up without them, still.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Form validation not working for simple email field
Form validation is not working when i use to validate the email. Here is my code <form id="forgetForm" class="form-horizontal" ...
Read more >
Client-side form validation - Learn web development | MDN
Using built-in form validation · required : Specifies whether a form field needs to be filled in before the form can be submitted....
Read more >
How to perform form validation for a required field in HTML
1. Required attribute: If you want to make an input mandatory to be entered by the user, you can use the required attribute....
Read more >
Build a form with validation - Flutter documentation
Validate the input by providing a validator() function to the TextFormField . If the user's input isn't valid, the validator function returns a...
Read more >
Form field validations - Adobe Support
Use validation if you want to only allow the entry of a specific format of data in the field. if the validation is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found