Hey guys,
i was wondering if some could help me with my problem.
I have custom module where I can choose a related Contact from the Contact Field (AJAX field with autocomlete)
My problem is that I have too many rows with the same name.
eg:
John Doe
John Doe
I would like to ADD a phone number behind the name in this autocomplete field
John Doe - 123444
John Doe - 242442
Thank you in advice
Petr
I have never tried but I think you can do it this way:
-
Create a custom field in Studio of type text (eg: name_phone_c)
-
Add this field in the list view
-
edit the file: custom/modules//metadata/listvewdefs.php
(in the path above change “” with the actual name of the module)
and add the following code:
array (
// this is the name of your custom field
'name' => 'name_phone_c',
// Use the label that you assigned when creating the field in Studio
'label' => 'LBL_NAME_PHONE_C',
// Here you put the fields you want to concatenate (I put Last name and work phone)
'customCode' => '{$fields.last_name.value} {$fields.phone_work.value}',
),
(you can remove my comments of course)
Then run a quick rebuild
I hope it works!
1 Like
Thank you for this message!
I guess that it doesnt solve my problem, just show custom defined field in the listview.
I need to show it in the editview - like in the attached image.
Thank you in advice
Petr
Does anybody realy know how to solve it? or where can I find the file where this “name” is being loaded?
Thank you in advice
Petr
Ok I have looked into this for you, I believe the files you are looking for are:
modules/Home/quicksearchQuery.php
and
modules/Home/QuickSearch.php
If you look in quicksearchQuery.php line 42 it shows you that it will check for a custom version of QuickSearch.php in custom/modules/Home/QuickSearch.php
So what you have to do is copy modules/Home/QuickSearch.php to custom/modules/Home/QuickSearch.php
and then make any changes you want in their.
I have not gone through this file so I cant not tell you exactly how to make the change you want, that part is up to you.
1 Like
You may also want to look into: include/QuickSearchDefaults.php and
include/javascript/quicksearch.js
1 Like
Thank You!!! It is exactly what I was looking for
Do you happen to have the code you changed still? I’m looking to do the exact same thing.
I also need this please help
Add custom JS to your editviewdefs.php and handle the keypress events for input via jquery autocomplete. Here is an example of what i did for zip codes.
1 Like
Can you share your code for this please?
it’s almost what i need
Could you give instructions, preferably step by step, how could you do this?
This would help me and possibly other members of the community.
thanks
Here is what I did. on \custom\modules\Home\QuickSearch.php Line: 305
I added an if else statement
if ($field == “name” && isset($results[$i]->fieldchoice) && $results[$i]->fieldchoice != “”) {
$data[‘fields’][$i][$field] = $results[$i]->$field." (".$results[$i]->fieldchoice")";
} else {
$data[‘fields’][$i][$field] = $results[$i]->$field;
}
if there’s better way to do this please help.
I think the key is in these file:
include/QuickSearchDefaults.php
Thanks,
BrozTechnologies
does not work for me
underlines quotation marks
this is my code from 301 line till 317
start here:
if (isset($listData[$field])) {
$data['fields'][$i][$field] = $listData[$field];
} else {
if (isset($results[$i]->$field)) {
$data['fields'][$i][$field] = $results[$i]->$field;
} else {
$data['fields'][$i][$field] = '';
}
this i added your code
// i added code here:
if ($field == “name” && isset($results[$i]->fieldchoice) && $results[$i]->fieldchoice != “”) {
$data[‘fields’][$i][$field] = $results[$i]->$field." (".$results[$i]->fieldchoice")";
} else {
$data[‘fields’][$i][$field] = $results[$i]->$field;
}
what did i wrong?
Thanks