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

Disable Error reports on fields. #75

Closed
greenspace10 opened this issue Aug 30, 2021 · 8 comments
Closed

Disable Error reports on fields. #75

greenspace10 opened this issue Aug 30, 2021 · 8 comments

Comments

@greenspace10
Copy link

I am trying to use input fields that are quite small and if an error is present on that field the text is very unpleasant looking, I have added a full error report on the bottom of the form. but would like to be able to disable error reporting on specific fields.

@PH7-Jack
Copy link
Member

Hello, what do you think about using "without-error", "errorless"? Has any suggestions?
In soon I'll implement it

@greenspace10
Copy link
Author

I like either of those options. leaning more towards errorless,,, but that's just my opinion.

@itepifanio
Copy link
Contributor

itepifanio commented Oct 18, 2021

I can work on this

itepifanio added a commit to itepifanio/wireui that referenced this issue Oct 18, 2021
itepifanio added a commit to itepifanio/wireui that referenced this issue Oct 18, 2021
itepifanio added a commit to itepifanio/wireui that referenced this issue Oct 20, 2021
PH7-Jack added a commit that referenced this issue Oct 21, 2021
Issue #75 - Add less errors attribute to the input
@PH7-Jack
Copy link
Member

This feature is now done. Enjoy WireUI @greenspace10

@donatiss
Copy link

will be this issue on radios/checkboxes?

@gRoberts84
Copy link

Unfortunately as @donatiss has pointed out, this only appears to apply to the input component.

Easiest solution was to publish the view assets and then anywhere that used $errors->has($name) or similar, add !$attributes->has('errorless') && before, e.g.

<div>
        <label for="{{ $id }}" class="flex items-center {{ !$attributes->has('errorless') && $errors->has($name) ? 'text-negative-600':'' }}">
            <div class="relative flex items-start">
                @if ($leftLabel)
                    <div class="mr-2 text-sm text-right">
                        <x-dynamic-component
                            :component="WireUi::component('label')"
                            class=""
                            :for="$id"
                            :label="$leftLabel"
                            :has-error="!$attributes->has('errorless') && $errors->has($name)"
                        />
                        @if($description)
                            <div class="text-gray-500">{{ $description }}</div>
                        @endif
                    </div>
                @endif

                <div class="flex items-center h-5">
                    <input {{ $attributes->class([
                        $getClasses(!$attributes->has('errorless') && $errors->has($name)),
                    ])->merge([
                        'type'  => 'checkbox',
                    ]) }} />
                </div>

                @if ($label)
                    <div class="ml-2 text-sm">
                        <x-dynamic-component
                            :component="WireUi::component('label')"
                            class=""
                            :for="$id"
                            :label="$label"
                            :has-error="!$attributes->has('errorless') && $errors->has($name)"
                        />
                        @if($description)
                            <div id="{{ $id }} . comments-description" class="text-gray-500">{{ $description }}</div>
                        @endif
                    </div>
                @endif
            </div>
        </label>

    @if (!$attributes->has('errorless') && $name)
        <x-dynamic-component
            :component="WireUi::component('error')"
            :name="$name"
        />
    @endif
</div>

@Uhasith
Copy link

Uhasith commented Nov 8, 2023

@itepifanio @greenspace10 Can anyone tell me this only applied for <x-input> ? For checkboxes and radio buttons it not working right?

@Uhasith
Copy link

Uhasith commented Nov 8, 2023

Unfortunately as @donatiss has pointed out, this only appears to apply to the input component.

Easiest solution was to publish the view assets and then anywhere that used $errors->has($name) or similar, add !$attributes->has('errorless') && before, e.g.

<div>
        <label for="{{ $id }}" class="flex items-center {{ !$attributes->has('errorless') && $errors->has($name) ? 'text-negative-600':'' }}">
            <div class="relative flex items-start">
                @if ($leftLabel)
                    <div class="mr-2 text-sm text-right">
                        <x-dynamic-component
                            :component="WireUi::component('label')"
                            class=""
                            :for="$id"
                            :label="$leftLabel"
                            :has-error="!$attributes->has('errorless') && $errors->has($name)"
                        />
                        @if($description)
                            <div class="text-gray-500">{{ $description }}</div>
                        @endif
                    </div>
                @endif

                <div class="flex items-center h-5">
                    <input {{ $attributes->class([
                        $getClasses(!$attributes->has('errorless') && $errors->has($name)),
                    ])->merge([
                        'type'  => 'checkbox',
                    ]) }} />
                </div>

                @if ($label)
                    <div class="ml-2 text-sm">
                        <x-dynamic-component
                            :component="WireUi::component('label')"
                            class=""
                            :for="$id"
                            :label="$label"
                            :has-error="!$attributes->has('errorless') && $errors->has($name)"
                        />
                        @if($description)
                            <div id="{{ $id }} . comments-description" class="text-gray-500">{{ $description }}</div>
                        @endif
                    </div>
                @endif
            </div>
        </label>

    @if (!$attributes->has('errorless') && $name)
        <x-dynamic-component
            :component="WireUi::component('error')"
            :name="$name"
        />
    @endif
</div>

@gRoberts84 If i want to use this for checkboxes or radio buttons should i manually configure that erroless attribute for those inputs in published config files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants