Add id to form elements instead of uuid
This commit is contained in:
parent
6bcea543fb
commit
520c1d0a62
app/View/Form
|
@ -10,16 +10,15 @@ class Editor extends Component
|
|||
|
||||
use HasFormDimensions;
|
||||
|
||||
public string $id;
|
||||
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public string $size = 'default',
|
||||
public ?string $hint = null,
|
||||
public bool $required = false,
|
||||
public string $label = '',
|
||||
public string $id = ''
|
||||
) {
|
||||
$this->id = str()->uuid()->toString();
|
||||
$this->id = $this->id ? $this->id : $this->name;
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
@ -10,8 +10,6 @@ class Lever extends Component
|
|||
|
||||
use HasFormDimensions;
|
||||
|
||||
public string $id;
|
||||
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public string $size = 'default',
|
||||
|
@ -20,8 +18,9 @@ class Lever extends Component
|
|||
public bool $disabled = false,
|
||||
public bool $required = false,
|
||||
public string $label = '',
|
||||
public string $id = ''
|
||||
) {
|
||||
$this->id = str()->uuid()->toString();
|
||||
$this->id = $this->id ? $this->id : $this->name;
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
@ -10,8 +10,6 @@ class Select extends Component
|
|||
|
||||
use HasFormDimensions;
|
||||
|
||||
public string $id;
|
||||
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public string $size = 'default',
|
||||
|
@ -20,8 +18,9 @@ class Select extends Component
|
|||
public string $label = '',
|
||||
public $options = [],
|
||||
public bool $disabled = false,
|
||||
public string $id = ''
|
||||
) {
|
||||
$this->id = str()->uuid()->toString();
|
||||
$this->id = $this->id ? $this->id : $this->name;
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
@ -10,17 +10,16 @@ class Text extends Component
|
|||
|
||||
use HasFormDimensions;
|
||||
|
||||
public string $id;
|
||||
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public string $size = 'default',
|
||||
public ?string $hint = null,
|
||||
public bool $required = false,
|
||||
public string $label = '',
|
||||
public string $type = 'text'
|
||||
public string $type = 'text',
|
||||
public string $id = ''
|
||||
) {
|
||||
$this->id = str()->uuid()->toString();
|
||||
$this->id = $this->id ? $this->id : $this->name;
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
Loading…
Reference in New Issue