Custom Javascript Function on DateTime Field

Hello Folks,

Its nice to be here. Thanks to Sugar for being so closed to their Community.

I am stuck in middle of one functionality requiring javascript onchange function on datetime field.

It involves some calculation and autofilling other fields based on this. I have found some old threads 

regarding this challenge but could not get much out of it.

Hey Sugar Heroes, please help me out on this. Any help would be appreciated.

Many Thanks.

Hats.
Parents
  • You can do this by editing custom/modules/<YOURMODULE>/metadata/editviewdefs.php

    I would create a custom javascript file and include it

    'useTabs' => false,
                            'includes' =>
                            array (
                                    0 =>
                                    array (
                                            'file' => 'custom/include/universal.js',
                                    ),
                                 ),

    Then you can add the onchange to your field

    array (
                                                    'name' => 'contract_start',
                                                    'label' => 'LBL_CONTRACT_START',
                                                    'tabindex' => '105',
                                                    'displayParams' =>
                                                    array (
                                                            'field' =>
                                                            array (
                                                                    'onChange' => 'GetTerm()',
                                                            ),
                                                    ),
                                            ),



    I hope that helps
Reply
  • You can do this by editing custom/modules/<YOURMODULE>/metadata/editviewdefs.php

    I would create a custom javascript file and include it

    'useTabs' => false,
                            'includes' =>
                            array (
                                    0 =>
                                    array (
                                            'file' => 'custom/include/universal.js',
                                    ),
                                 ),

    Then you can add the onchange to your field

    array (
                                                    'name' => 'contract_start',
                                                    'label' => 'LBL_CONTRACT_START',
                                                    'tabindex' => '105',
                                                    'displayParams' =>
                                                    array (
                                                            'field' =>
                                                            array (
                                                                    'onChange' => 'GetTerm()',
                                                            ),
                                                    ),
                                            ),



    I hope that helps
Children
No Data