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.

'required=false' on amplifyTextField not being respected

See original GitHub issue

Env:

When adding additional SignIn fields, required="false" is not respected, SignIn form still requires these fields.

Code fragment:

 <authenticator
      initial-state="signIn"
      :login-mechanisms="['email']"
      :sign-up-attributes="['email']"
    >
      <template v-slot:sign-up-fields>
        <amplify-text-field
          id="name"
          label="Full Name"
          name="name"
          placeholder="Full Name"
          required="true"
        />
        <amplify-text-field
          id="title"
          label="Title"
          name="custom:title"
          placeholder="Professional Title"
          required="false"
        />
        <amplify-text-field
          id="credentials"
          label="Credentials"
          name="custom:credentials"
          placeholder="Professional Credentials"
          required="false"
        />
        <authenticator-sign-up-form-fields />
      </template>
</authenticator>

Outcome: image

Expected Outcome: Non-required fields should not be required in the UI

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wlee221commented, Dec 1, 2021

Hello @jeff-wishnie, we’ll close this as per @ErikCH’s comment. Please let us know if problem persists or you have additional questions.

1reaction
ErikCHcommented, Nov 23, 2021

Hi @jeff-wishnie !

When you’re passing the required attribute into <amplify-text-field> you’re passing it as text instead of a boolean. So the text always resolves to true. What you need to do is bind false like this :required="false" . Could you try that and see if it fixes your problem?

The base-input component props I’m passing aren’t explicitly set. That’s something I could probably improve in the future. Since they aren’t declared as props they are automatically added to the outermost element in the base-input component. Which is <input>

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL directive ordering not respected · Issue #6176 - GitHub
The order of directives on a graphql schema is not always respected. ... In this case, the order the directives are applied is:...
Read more >
TextField | Amplify UI for React
In some applications it may be desirable to hide the label when the field purpose is visually apparent such as a search field...
Read more >
Using nullability in GraphQL
So we can declare some fields to be non-null in our GraphQL schema, but that doesn't guarantee we won't have some code in...
Read more >
Material-ui 4.9.5 TextField attribute "required" not working
If we have multiple TextField s, the con is you have to reportValidity on each element, but the pro is you have more...
Read more >
Unity Products:Amplify Shader Editor/Manual
This technique is a simple approximation to a light phenomenon that often occurs when waves travel from a medium with a given refractive...
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