Re: relationship textfield
OK, I' ve found my code to drive a textfield from a dropdown 
I create this inside the Accounts module. Let'see the steps I made:
- In Studio I created custom dropdown myDD and custom text field myTXT, saved and added both new fields to editview
- Added only myTXT to detailview.
- opened <sugar-root>\custom\modules\Accounts\metadata\editviewdef s.php and changed code for myDD with the following:
PHP Code:
1 =>
array (
'name' => 'myDD_c',
'label' => 'LBL_MYDD',
'displayParams' =>
array (
'javascript' => 'onchange="changeName();"',
),
),
),
- Added to <sugar-root>\modules\Accounts\Account.js the following code for ChangeName function:
Code:
function changeName(){
if (document.EditView.myDD_c.selectedIndex != 0) {
document.EditView.myTXT_c.value =document.EditView.myDD_c.options[document.EditView.myDD_c.selectedIndex].text;
}
else{
document.EditView.myTXT_c.value = 'Select a value from dropdown';
}
}
That's pretty much it.
In my case I used three linked dropdowns and three text fields to make address data entry: the user selects a country from the first dropdown, so that the second dropdown shows only provinces for that country; picking from second dropdown makes the third list only the cities inside that province. When user select a city from the last dropdown, data from 3 dropdowns is copied to billing_address_country, billing_address_state, billing_address_city.
After saving, detail view shows those data inside the default textfields for billing address.
What do you think the cookie monster eats ?
Bookmarks