demarches-normaliennes/app/javascript/controllers/radio_enabled_submit_controller.tsx
Eric Leroy-Terquem 526f70f9c0 add wizard
2023-05-31 11:38:16 +02:00

14 lines
358 B
TypeScript

import { Controller } from '@hotwired/stimulus';
export class RadioEnabledSubmitController extends Controller {
static targets = ['submit'];
declare readonly submitTarget: HTMLButtonElement;
click() {
if (
this.element.querySelectorAll('input[type="radio"]:checked').length > 0
) {
this.submitTarget.disabled = false;
}
}
}