1import { Controller } from "@hotwired/stimulus" 2 3// PO registration form: reveal the credit-terms section only when the 4// applicant picks a credit account. The server validates authoritatively â 5// this just keeps the prepay path short and stops hidden required fields 6// from silently blocking submit (reportValidity can't prompt a hidden field). 7export default class extends Controller { 8 static targets = ["creditSection", "preference"] 9 10 connect() { 11 this.toggle() 12 } 13 14 toggle() { 15 const credit = this.preferenceTargets.find((el) => el.checked)?.value === "credit" 16 this.creditSectionTarget.classList.toggle("hidden", !credit) 17 this.creditSectionTarget.querySelectorAll("[data-credit-required]").forEach((el) => { 18 el.required = credit 19 }) 20 } 21}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.