nova-sluggable icon indicating copy to clipboard operation
nova-sluggable copied to clipboard

hidden input option

Open atmediauk opened this issue 5 years ago • 2 comments

Is it possible to submit the field as a hidden input?

For example adding ->hidden() to the chain like:

            SluggableText::make('Name')
                ->rules('required'),
            Slug::make('Slug')
                ->slugUnique()
                ->slugModel(static::$model)
                ->rules('required', 'alpha_dash', 'max:80')
                ->creationRules('unique:somegroup,slug')
                ->hidden(),

I know I can do this through a custom field or by just setting the value in the model on ::saving but it would be nice to still make use of this packages rules, validation etc.

I'd like to set the value but just remove the visibility for some users.

atmediauk avatar May 04 '19 10:05 atmediauk

@atmediauk you should be able to use all visiblity methods listed in nova's documentation in the section Showing / Hiding Fields.

So this example ..

Slug::make(...)
  ->hideWhenCreating()
  ->hideWhenUpdating()

.. will hide the slug field when updating and creating.

wize-wiz avatar Oct 10 '19 15:10 wize-wiz

@wize-wiz I know I'm late but @atmediauk asks to add to field hidden type, not fully removing. These don't work in our cases. ->hideWhenCreating()->hideWhenUpdating()

nurmuhammet-ali avatar Oct 07 '21 00:10 nurmuhammet-ali