Populating the field with columns in the database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gundogduyakici
    Senior Member
    • Mar 2018
    • 165

    Populating the field with columns in the database

    There are cities in the database table. How can I fill in an entity field with it?
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    I think the best way in this case is to create an entity City, and use it as a link to entity

    Comment

    • gundogduyakici
      Senior Member
      • Mar 2018
      • 165

      #3
      I have one more question. I will do the same in the towns. But how do I relate the city and the town? Because there are the same ID's in the towns.
      Last edited by gundogduyakici; 03-21-2018, 12:33 PM.

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        use this id as additional field, not basic ID. Like SIC code in Account.

        Comment

        • gundogduyakici
          Senior Member
          • Mar 2018
          • 165

          #5
          I did. But, for example, if I choose a city, I can not show the towns connected to it automatically.. tanya

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            Open Opportunity. If you select account, you can choose related contacts only.
            or check tree views (Knowledge Base or Reports Categories), if tree view is good for you

            Which way is better for you?

            Comment

            • gundogduyakici
              Senior Member
              • Mar 2018
              • 165

              #7
              like Tree view. tanya

              Comment

              • gundogduyakici
                Senior Member
                • Mar 2018
                • 165

                #8
                But I want to do these as areas within the customers. Because they are the city and the town of the client. It has to be like Select. tanya
                Attached Files

                Comment

                • tanya
                  Senior Member
                  • Jun 2014
                  • 4308

                  #9
                  ?
                  for this better and easier to develop it like contacts in Opportunity. Why tree view if the depth is up to 2

                  Comment

                  • gundogduyakici
                    Senior Member
                    • Mar 2018
                    • 165

                    #10
                    I'm sorry I told him wrong. Did I tell you what I mean? tanya

                    Comment

                    • gundogduyakici
                      Senior Member
                      • Mar 2018
                      • 165

                      #11
                      function changeTowns(a) {
                      var select = $('select[name="town_id"]');
                      select.html("");
                      if ($(a).val() == "") {
                      select.append('<option value="">Lütfen Seçiniz</option>');
                      }
                      $.ajax({
                      type: 'GET',
                      url: '<?php echo base_url('admin/ajax/getTowns/');?>' + $(a).val(),
                      dataType: 'json',
                      beforeSend: function () {
                      $('.loadingCity').removeClass("hidden"),
                      $('.citySelect').addClass("hidden")
                      },
                      success: function (data) {
                      if (data.status == 404) {
                      alert(data.msg);
                      } else {
                      $('.loadingCity').addClass("hidden");
                      $('.citySelect').removeClass("hidden");
                      select.append('<option value="">Lütfen Seçiniz</option>');
                      $.each(data, function (index, element) {
                      select.append('<option value="' + element.id + '">' + element.name + '</option>');
                      })
                      }
                      }
                      });
                      }

                      Comment

                      Working...