Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: get selected value? #175

Open
madsem opened this issue May 21, 2021 · 2 comments
Open

Question: get selected value? #175

madsem opened this issue May 21, 2021 · 2 comments

Comments

@madsem
Copy link

madsem commented May 21, 2021

Thanks a lot for this package! :)

I'm trying to configure a Model that can have various types and sub-types.
In the Ui when a user selects the sub-type, I'd like to show field names based on the sub-type.

In this case API connection details for various API integrations, where users can enter their own details like api_token or other required parameters that can of course differ between integrations...

I also made it work, as shown below. The problem is though, that the selected value is hard-coded, is there a way to get the selected value dynamically?

NovaDependencyContainer::make([

                Select::make('Api Integration', 'api_integration')
                    ->help('Select API integration.')
                    ->options(
                        make_nova_options([
                            config('services.conversion_apis.cj'),
                        ], 'label', 'type')
                    )
                    ->displayUsingLabels(),

                NovaDependencyContainer::make([

                    KeyValue::make('Api Configuration', 'api_user_config')
                        ->rules('json')
                        ->required()
                        ->disableAddingRows()
                        ->disableEditingKeys()
                        ->disableDeletingRows()
                        ->keyLabel('Config Name')
                        ->valueLabel('Config Value')
                        ->withMeta([
                            'value' => $this->data ?? config('services.conversion_apis.cj.user_config'),
                        ]),

                ])->dependsOn('api_integration', 'cj'), // <---- can I get this somehow?

            ])->dependsOn('integration_type', ConversionSourceTypes::Api),
@ObaydaAlesawi
Copy link

@madsem Did you get any updates or progress here?

@madsem
Copy link
Author

madsem commented Oct 27, 2021

Nope sorry @Algeneralo, I remember i solved it temporarily by copying the code.
I think in the end I will just abandon Nova :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants