Custom Field Send Multiple Data

I have to create a custom field and I have to send extra form data while submit the form with extra customization. like Here I make custom field by extending Rich Editor
CustomBio::make('bio')
->columnSpanFull(),
CustomBio::make('bio')
->columnSpanFull(),
This is my custom field class
<?php

namespace PackiMaster\Bio\Forms\Components;

use Filament\Forms\Components\RichEditor;
use Filament\Forms\Set;

class CustomBio extends RichEditor
{
protected string $view = 'bio::forms.components.bio-editor';

protected array|\Closure $mentionsItems = [];

public function setUp(): void
{
parent::setUp();

// Adding a hook to modify the form data on submission
$this->afterStateHydrated(function ($component, $state, Set $set) {
// Original state remains untouched
$set($this->getStatePath(), $state);

// Add mentions as separate data
$set('bio_with_style', 'SOME_EXTRA_CUSTOMIZATION');
});

}

}
<?php

namespace PackiMaster\Bio\Forms\Components;

use Filament\Forms\Components\RichEditor;
use Filament\Forms\Set;

class CustomBio extends RichEditor
{
protected string $view = 'bio::forms.components.bio-editor';

protected array|\Closure $mentionsItems = [];

public function setUp(): void
{
parent::setUp();

// Adding a hook to modify the form data on submission
$this->afterStateHydrated(function ($component, $state, Set $set) {
// Original state remains untouched
$set($this->getStatePath(), $state);

// Add mentions as separate data
$set('bio_with_style', 'SOME_EXTRA_CUSTOMIZATION');
});

}

}
How to send extra data
bio_with_style
bio_with_style
on submit the form ?
5 Replies
toeknee
toeknee6d ago
Where would the extra data come from? Can you explain more?
Asmit Nepali
Asmit Nepali6d ago
Actually I want to add extra form data with
bio_with_style
bio_with_style
which contain original field state with some extra customization
toeknee
toeknee6d ago
so you will want to manipluate it on mutate function
Asmit Nepali
Asmit Nepali6d ago
Basically while I try to submit the filament form the form data should look like this
[ 'bio' => 'hello bio', 'bio_with_style' => 'some style and bio' ]
[ 'bio' => 'hello bio', 'bio_with_style' => 'some style and bio' ]
My custom field should add these data on form data Is there any way to do this ?
toeknee
toeknee6d ago
probably, have a look how the google maps field does it from fetching lat/lon?
Want results from more Discord servers?
Add your server