Back

Enum Required Error

  • 0
  • Databases
Infinil
19 Apr, 2023, 13:12

I am trying to create required enum attribute but unable to-

TL;DR
The user is encountering an issue with creating a required enum attribute in Appwrite. They mention that deleting the 'select' element allows the request to work without the select value. They provide a Github link to the Console issues and suggest upgrading to version 1.3.1 as a workaround until the bug is fixed. They also suggest changing the attribute to an integer as a temporary solution. The related issue on Github is also mentioned. No solution is provided in the support thread.
Infinil
19 Apr, 2023, 13:12

its stuck on select a value

Binyamin
19 Apr, 2023, 13:14

I wasn't able to reproduce it What version of Appwrite you're using?

Binyamin
19 Apr, 2023, 13:18

In the current version the dialog is a bit different

Binyamin
19 Apr, 2023, 13:36

Got it I made a mistake I though it's an old version when it's actually the latest one My bad

Binyamin
19 Apr, 2023, 13:39

It's seems like when you mark the Required field as required its also applied to the Default value one.

TypeScript
<Enum
    id="default"
    label="Default value"
    attribute={{
        key: data.key,
        type: 'string',
        status: 'enabled',
        format: 'enum',
        elements: data.elements ?? [],
        required: data.required,
        default: data.default
    }}
    bind:value={data.default} />
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}>
    Indicate whether this is a required attribute
</InputChoice>
Infinil
19 Apr, 2023, 13:56

oh

Infinil
19 Apr, 2023, 13:57

for now imma create an integer attribute

Infinil
19 Apr, 2023, 13:57

since its a difficulty attribute and i think 0,1,2 will do instead of easy, medium and hard xd

Binyamin
19 Apr, 2023, 13:58

Yes for now that's seems right

Binyamin
19 Apr, 2023, 13:58

Although I have some idea, Let me check

Drake
19 Apr, 2023, 14:11

I think this is the related issue: https://github.com/appwrite/appwrite/issues/5391

Binyamin
19 Apr, 2023, 14:19

Okay, I've upgrade my Appwrite to 1.3.1

You can do this as a workaround till the bug is fixed.

Binyamin
19 Apr, 2023, 14:21

What I'm doing I just deleted the select element And the request worked as it doesn't really need the select value when required.

I've mentioned it in the Console issues https://github.com/appwrite/console/issues/412

Infinil
19 Apr, 2023, 14:23

ah nice one

Drake
19 Apr, 2023, 14:28

Is it okay if we just use the appwrite issue and close the console one?

Binyamin
19 Apr, 2023, 14:29

Sure thing

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more