[TYPO3-mvc] TCA - Radio buttons on multiple fields

Gianluca Strafella gianluca.strafella at webformat.com
Wed Jun 25 09:30:04 CEST 2014


Hi Peter,
you can type "field2" with type "user" and specify a "user_func", i.e.:

'field2' => array(
          'exclude' => 1,
          'label' => 'Field 2',
          'config' => array(
                  'type' => 'user',
		 'user_func' => 
'EXT:your_ext/class.user_yourclassname.php:user_yourclassname->yourMethodName'
          )

and implement in class 
your_ext/class.user_yourclassname.php:user_yourclassname

the method yourMethod:

function yourMethodName($pa,$fObj){
	//do something with form parameter
	//and build html about field2	
}


More infos on this link: 
http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/User/Index.html#userfunc

After this, you can insert property "requestUpdate" on field1 tca 
config, i.e.

  'field1' => array(
          'exclude' => 1,
          'label' => 'Field 1',
	 'requestUpdate' => 'field2'
          'config' => array(
                  'type' => 'radio',
                  'items' => array(
                          array(
                                  'Active',1
                          ),
                  )
	        )

More infos on this link: 
http://docs.typo3.org/typo3cms/TCAReference/Reference/Ctrl/Index.html#requestupdate

You can find others useful informations at this link: 
http://www.slideshare.net/mauro.lorenzutti/typo3-tca-tips-tricks

Good luck,

Gianluca Strafella

Software Developer
gianluca.strafella at webformat.com

WEBFORMAT srl – www.webformat.com


Il 23/06/2014 17:17, Peter R ha scritto:
> Hello,
>
> is it possible to create radio button behavior on multiple fields?
> If I click field1, field2 should be unchecked and backwards.
>
> 'field1' => array(
>         'exclude' => 1,
>         'label' => 'Field 1',
>         'config' => array(
>                 'type' => 'radio',
>                 'items' => array(
>                         array(
>                                 'Active',1
>                         ),
>                 )
>         )
> ),
> 'field2' => array(
>         'exclude' => 1,
>         'label' => 'Field 2',
>         'config' => array(
>                 'type' => 'radio',
>                 'items' => array(
>                         array(
>                                 'Active',1
>                         ),
>                 )
>         )
> ),
>
> I don't want to create a select or something else.
> If isn't possible I would use checkbox.
>
> Thank you for any help.


More information about the TYPO3-project-typo3v4mvc mailing list