This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

sayaamiruladli51935
sayaamiruladli51935

i have weird client request where...

context: when update only (not create)

tabs:
    fields:
        is_social:
            label: 'Enable Social Push'
            type: checkbox
            tab: Social
            disabled: true
        social_description:
            label: 'Social Description'
            size: large
            span: full
            type: richeditor
            tab: Social
            trigger:
                action: show
                field: is_social
                condition: checked
        social_image:
            label: Social Image
            type: mediafinder
            mode: image
            tab: Social
            trigger:
                action: show
                field: is_social
                condition: checked

show social_desc and social_image field when is_social is checked, and i WANT is_social field is hidden. already using hidden: true but still not working. current workaround is to disable is_social field, but i dont want that.

mjauvin
mjauvin

You can specify the context in your field definition:

is_social@update:
   ...field definition...
is_social@create:
   ...field definition...

Last updated

sayaamiruladli51935
sayaamiruladli51935

marc.jauvin24240 said:

You can specify the context in your field definition:

is_social@update: ...field definition... is_social@create: ...field definition...

it doesnt matter if it create or update, how to hide field when other field is depend on it?

Flynsarmy
neilcarpenter
neilcarpenter

Isn't this what you want?

is_social:
  label: 'Enable Social Push'
  type: checkbox
  tab: Social

social_description@update:
  label: 'Social Description'
  size: large
  span: full
  type: richeditor
  tab: Social
  trigger:
    action: show
    field: is_social
    condition: checked

social_image@update:
  label: Social Image
  type: mediafinder
  mode: image
  tab: Social
  trigger:
    action: show
    field: is_social
    condition: checked

From your comments it seems you want to hide the is_social checkbox if it's true for both creating and updating?

If that's the case, then why? Your user wouldn't be able to deactive that option.

Be interesting to know why you think you need this because I feel there's another way around your problem.

sayaamiruladli51935
sayaamiruladli51935

Flynsarmy said:

Try using the filterFields method:

https://octobercms.com/docs/backend/forms#filter-form-fields

this one solve my problem, thank you so much moderator always help me out :D didnt know that kind of thing exists. maybe i didnt read the doc enough lmao. tq guys

Last updated

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.