Multiple Field in Custom Field

Hi, pls help. How can I handle or get the 2 values from a custom field?
No description
Solution:
I've used KeyValue instead and made some customization. Thanks for your time 🙂
Jump to solution
17 Replies
Vp
Vp4mo ago
using wire:model
lazydog
lazydog4mo ago
Like this? Upon submission, I can't read that field. Just the custom filed but has null value
No description
lazydog
lazydog4mo ago
Im using Filament Form Field (Custom Field)
Vp
Vp4mo ago
Really? but your <input ... doesn't look like filament form field.
lazydog
lazydog4mo ago
Yeah, that's why I ask because I don't know how to do it using 2 fields in 1 custom form field. Above code is just an example.
lazydog
lazydog4mo ago
No description
Vp
Vp4mo ago
then why not provide some code to check for.. I answer you by guessing only...
lazydog
lazydog4mo ago
My fault, I've screenshot it
Vp
Vp4mo ago
Don't.. read #✅┊rules to format code
lazydog
lazydog4mo ago
@php
$statePath = $getStatePath();
$state = $getState();
@endphp

<x-dynamic-component
:component="$getFieldWrapperView()"
:field="$field"
>
<div>
<div class="sm:flex rounded-lg shadow-sm">
<input wire:model="inputName1"
class="fi-input pe-11 block w-full border-gray-200 sm:shadow-sm -mt-px -ms-px first:rounded-t-lg last:rounded-b-lg sm:first:rounded-s-lg sm:mt-0 sm:first:ms-0 sm:first:rounded-se-none sm:last:rounded-es-none sm:last:rounded-e-lg text-sm relative focus:z-10 focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-slate-900 dark:border-gray-700 dark:text-gray-400 dark:focus:ring-gray-600"
>
<input wire:model="inputName2"
class="fi-input pe-11 block w-full border-gray-200 sm:shadow-sm -mt-px -ms-px first:rounded-t-lg last:rounded-b-lg sm:first:rounded-s-lg sm:mt-0 sm:first:ms-0 sm:first:rounded-se-none sm:last:rounded-es-none sm:last:rounded-e-lg text-sm relative focus:z-10 focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-slate-900 dark:border-gray-700 dark:text-gray-400 dark:focus:ring-gray-600"
>
</div>
</div>
</x-dynamic-component>
@php
$statePath = $getStatePath();
$state = $getState();
@endphp

<x-dynamic-component
:component="$getFieldWrapperView()"
:field="$field"
>
<div>
<div class="sm:flex rounded-lg shadow-sm">
<input wire:model="inputName1"
class="fi-input pe-11 block w-full border-gray-200 sm:shadow-sm -mt-px -ms-px first:rounded-t-lg last:rounded-b-lg sm:first:rounded-s-lg sm:mt-0 sm:first:ms-0 sm:first:rounded-se-none sm:last:rounded-es-none sm:last:rounded-e-lg text-sm relative focus:z-10 focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-slate-900 dark:border-gray-700 dark:text-gray-400 dark:focus:ring-gray-600"
>
<input wire:model="inputName2"
class="fi-input pe-11 block w-full border-gray-200 sm:shadow-sm -mt-px -ms-px first:rounded-t-lg last:rounded-b-lg sm:first:rounded-s-lg sm:mt-0 sm:first:ms-0 sm:first:rounded-se-none sm:last:rounded-es-none sm:last:rounded-e-lg text-sm relative focus:z-10 focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-slate-900 dark:border-gray-700 dark:text-gray-400 dark:focus:ring-gray-600"
>
</div>
</div>
</x-dynamic-component>
I need to read and get the values from 2 input fields
Vp
Vp4mo ago
Did you define in your components?
lazydog
lazydog4mo ago
Define meaning this?
php artisan make:form-field CustomField
php artisan make:form-field CustomField
I've ran that command and add html codes from created views Used CustomField::make() to my resource
Solution
lazydog
lazydog4mo ago
I've used KeyValue instead and made some customization. Thanks for your time 🙂
Asmit Nepali
Asmit Nepali2w ago
@denknows Can you please provide what customization you have done and how to solve this ?
lazydog
lazydog2w ago
hi @Asmit Nepali I've extended KeyValue class and customized the view
Asmit Nepali
Asmit Nepali7d ago
@lazydog Can you please share some code here ?