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

Fibonacci
Fibonacci

Hi, I have a little bit question about field dependencies on this doc http://octobercms.com/docs/backend/forms#field-dependencies

in that example, the fields type are dropdown. How to implement in the others field.

for example,

name:
    label: Username
    type: text
greeting:
    label: Greeting
    type: text
    dependsOn: name

If I type 'Fibonacci' in field 'name' and then the 'greeting' will change to 'Hello, Fibonacci'

Thanks

beaudinngreve10852
Bhargav
Crazymodder
Crazymodder

I only know the Input preset converter which converts Text to slugs. I though for you requirements you have to write a short javascript.

Daniel81
hi.ibnumardini56040
hi.ibnumardini56040

Crazymodder said:

I only know the Input preset converter which converts Text to slugs. I though for you requirements you have to write a short javascript.

can you give a sample code?

khoanndang62668
program.es
program.es

May your try to add in your model?

public function filterFields($fields, $context = null)

{

   if($fields->name->value != "") { 

       $fields->greeting->value = "'Hello, ". $fields->name->value; 

   } 

}

1-8 of 8

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