Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if get error from backend UForm set all inputs attr disabled #2612

Closed
aloky opened this issue Nov 12, 2024 · 4 comments
Closed

if get error from backend UForm set all inputs attr disabled #2612

aloky opened this issue Nov 12, 2024 · 4 comments
Assignees
Labels
bug Something isn't working needs reproduction v3 #1289

Comments

@aloky
Copy link

aloky commented Nov 12, 2024

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Version

v3.0.0-alpha.8

Reproduction

<UForm
    :state="state"
    :schema="schema"
    class="space-y-3"
    @submit="submit"
  >
    <UFormField
      name="text"
    >
      <UTextarea
        v-model="state.text"
        class="w-full"
        :rows="6"
        size="xl"
      />
    </UFormField>
    <UFormField
      v-if="!authUser"
      name="email"
      :label="$t('label.email')"
    >
      <UInput
        v-model="state.email"
        icon="i-solar-letter-bold-duotone"
        :placeholder="$t('placeholder.enter_email')"
        @update:model-value="state.email = $event || null"
      />
    </UFormField>
    <UButton
      block
      type="submit"
      :loading="isLoading"
      :label="$t('button.submit')"
    />
  </UForm>

Description

Why if get error from backend UForm set all inputs attr disabled?

Additional context

No response

Logs

@aloky aloky added bug Something isn't working triage v3 #1289 labels Nov 12, 2024
@aloky
Copy link
Author

aloky commented Nov 12, 2024

Image

@romhml
Copy link
Collaborator

romhml commented Nov 12, 2024

I'm guessing this related to your loading state, inputs are disabled while the form is loading. Do you mind sharing your submit function?

You should be able to use loading-auto on the button component to handle it automatically.
https://ui3.nuxt.dev/components/button#loading

@aloky
Copy link
Author

aloky commented Nov 13, 2024

@romhml Thank you, I found out why it was like that, it turns out I didn't write it catch.

@aloky
Copy link
Author

aloky commented Nov 13, 2024

wrong

try {}
finally {}

correct

try {}
catch {}
finally {}

@romhml romhml closed this as completed Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs reproduction v3 #1289
Projects
None yet
Development

No branches or pull requests

2 participants