Skip to content

[LiveComponent] Should input fields honor browser validation? #441

@NicoHaase

Description

@NicoHaase

In a LiveComponent, I use an input field with required attribute. The action is triggered manually by a button. As a shortened example, my component markup looks like the following:

<input type="text" id="ean" name="ean" value="{{ ean }}" data-model="norender|ean"
   required="required" class="form-control" autofocus>
<input type="submit" class="btn btn-primary" data-action="live#action" data-action-name="checkIn"
   data-loading="addAttribute(disabled)" value="Submit">

Even if I leave the input field empty, the AJAX request is sent out. Shouldn't the JS code first run the browser's built-in form validation to check whether all fields are valid?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions