Hi Andrew
Thanks a lot for your suggestions.
I have followed your instructions and now I have three
JS codes in the moldules/Account folder
Account.
js which works for fields provincia_c[] and municipio_c[] and which is used in EditViewDef working fine.
Now to use in the Basic Search Form and Advanced Search Form I have created :
Account_Search.
js which is the same code than Account.
js but with the fields renamed to provincia_c_basic[] and municipio_c_basic[]
Account_SearchAdvanced.
js which is also a copy of Account.
js but with fields renamed to provincia_c_advanced[] and municipio_c_advanced[].
I have added the two
js codes in the custom\modules\Accounts\metadata\searchdefs.php as you can see here
PHP Code:
'templateMeta' =>
array (
'maxColumns' => '3',
'widths' =>
array (
'label' => '10',
'field' => '30',
),
'javascript' => '<script type="text/javascript" src="modules/Accounts/Account_Search.js"></script>',
'javascript' => '<script type="text/javascript" src="modules/Accounts/Account_SearchAdvanced.js"></script>',
),
However when I lauch sugar, and I review the source code using firefox of the Accounts view, I dont find the
JS code loaded. Also I have added some debug comments in the codes and dont get them in the Error Console which makes me think that
JS code is not being loaded in the SearchForm. What do you think?
Also just for me to confirm, in the searchdefs.php fields are still called provincia_c[] and municipio_c[] in both advanced search and basic search, and the way I call the
js in these fields is
Basic Search
PHP Code:
'provincia_c' =>
array (
'type' => 'multienum',
'default' => true,
'studio' => 'visible',
'label' => 'LBL_PROVINCIA',
'width' => '10%',
'name' => 'provincia_c',
'displayParams' => array ('javascript' => 'onchange="initData();"'),
),
'municipio_c' =>
array (
'type' => 'multienum',
'default' => true,
'studio' => 'visible',
'label' => 'LBL_MUNICIPIO',
'width' => '10%',
'name' => 'municipio_c',
),
Advanced Search
PHP Code:
'provincia_c' =>
array (
'type' => 'multienum',
'default' => true,
'studio' => 'visible',
'label' => 'LBL_PROVINCIA',
'width' => '10%',
'name' => 'provincia_c',
'displayParams' => array ('javascript' => 'onchange="initData_Advanced();"'),
),
'municipio_c' =>
array (
'type' => 'multienum',
'default' => true,
'studio' => 'visible',
'label' => 'LBL_MUNICIPIO',
'width' => '10%',
'name' => 'municipio_c',
),
Last question is regarding what you said about we are now in the 'searchform' and not in 'EditView'. I dont make reference to this forms in the code, is there something else I should chage or this was just to point me that fields are called differently in both forms?
Thanks a lot once more for your help!!.
Bookmarks