Gediminas
Can a MenuItem redirect to an external URL?
Hello,
I'd like to be able to add a new button to the user menu, which would redirect to an external website.
I'm following the docs and adding the button the panel like it's shown:
->userMenuItems([ MenuItem::make() ->label('Test Url') ->url(fn (): string => 'www.test.com', true) ->icon('heroicon-o-cog-6-tooth'), // ... ]);The button appears, but the problem is that the url is using the project domain and appending the specified url at the end like so: mytestproject.local/www.test.com Can I somehow drop the project domain from the generated url and go straight to www.test.com on button click? Thanks!
4 replies
Is it possible to do a dynamic hint action?
Hello, I'm trying to add a hint action to a text input which would return a base url defined in the config + the value of the TextInput at the end.
TextInput::make('url')
->hintAction(
Action::make('goToUrl')
->url(function () {
// this should return a base url with the input value attached to the end
})
)
As an example, let's say my base url is "www.test.com" and then I input something into the "url" TextInput, like /users. The end result would be that the hint action url should be "www.test.com/users".
I'm not sure how to live update the hint action. Is there a way?
4 replies
Can Form Actions appear dynamically?
Hello,
I have a custom action that I have added to an edit resource page, using getFormActions() method.
I'm wondering if there's a way to have this action hidden by default and only visible if certain toggle fields have been set to true?
Thanks
3 replies
[Reapeater] Repeater question about one column getting data from the other one
Hi guys,
I have a "users" table, which has id, title and age columns among others.
I'd like to build a repeater made from 2 columns.
The first column would be a general select, made up of user id's and titles.
The second column, I'd like to be a text input and get filled with users age upon the selection of a user in the first column. I'm having trouble coming up on how to do this and, is it even possible?
Any help would be appreciated, thanks!
5 replies
Custom form action help
Hi,
Is there a way modify form data when submitting from a custom form action?
I've added this into my createPost.php
protected function getFormActions(): array
{
return [
$this->getCreateFormAction(),
$this->getCreateAndSetActiveFormAction(),
$this->getCancelFormAction(),
];
}
protected function getCreateAndSetActiveFormAction(): Action
{
return Action::make('createandsetactive')
->label('Create and set active')
->submit('createandsetactive');
}
This button works correctly in creating a Post record, but I'd like to be modify the 'active' parameter that's in the form data and set it to TRUE before creating the record. Is such a thing possible?10 replies