How to show specific data into zoho crm fields.

How to show specific data into zoho crm fields.

I have a from which contains two zoho crm fields. One is bind to account and another is bind to contacts. When I select an account from crm fields then another crm field should only show contact related to that account name.
How is it possible?
string default.getAccountName(int id)
{
    crmResp = zoho.crm.getRecordById(("Accounts"), input.id);
    accid = crmResp.get("ACCOUNTID");
    Billing_Street = crmResp.get("Billing Street");
    Billing_City = crmResp.get("Billing City");
    Billing_State = crmResp.get("Billing State");
    Billing_Code = crmResp.get("Billing Code");
    Address1 = Billing_Street + " " + Billing_City + " " + Billing_State + " " + Billing_Code;
    return Address1;
}
On user input
acc = thisapp.default.getAccountName(input.Bill_To_ID);
input.Address = acc;

string default.getContactName(int contactid)
{
    crmResp = zoho.crm.getRecordById("Accounts", input.contactid);
    accid = crmResp.get("ACCOUNTID");
    resp=zoho.crm.getRelatedRecords("Contacts","Accounts",accid)
    Mailing_Street = resp.get("Mailing Street");
    Mailing_City = resp.get("Mailing City");
    Mailing_State = resp.get("Mailing State");
    Mailing_Code = resp.get("Mailing Code");
    Address1 = Mailing_Street + " " + Mailing_City + " " + Mailing_State + " " + Mailing_Code;
    return Address1;
    //info jlist;
}
On user input
acc1 = thisapp.default.getContactName(input.Bill_To_ID);
input.Address1 = acc1;