Change address field, hide or remove province

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ITI
    Junior Member
    • Feb 2020
    • 5

    Change address field, hide or remove province

    For every instance of an address, the State is displayed, what is the best way to remove or hide that field?
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #2
    I think you could edit the fied`s json file, but I did not test it. This would be the approach:

    in application/Espo/Resources/metadata/fields go to address.json find

    Code:
    "state": {
    "type":"varchar",
    "trim": true,
    "maxLength": 255,
    "view": "views/fields/address-state",
    "customizationOptionsDisabled": true,
    "pattern": "$noBadCharacters"
    },


    and delete it.

    To get it update safe, create a loder fields under custom/Espo/Resources/metadata and copy the altered file there and leave the original as it is.

    Comment

    • ITI
      Junior Member
      • Feb 2020
      • 5

      #3
      I was happy when I see the file and your reaction, unfortunally not succesful
      I also delete in actualField > "state".
      And clear cache.

      Nothing change.

      Is there more to be needed to change?

      Comment

      • shalmaxb
        Senior Member
        • Mar 2015
        • 1602

        #4
        You are right, I tested right now and it does not remove the "state" field.
        A workaround could be, that you don not use in your Layout Manager the complete address field but the parts of it that will be generated automatically, when using the adress field. Every field of the one address field is also available as single field,

        Comment

        • albertjoseph
          Junior Member
          • Dec 2022
          • 4

          #5
          Originally posted by ITI
          I was happy when I see the file and your reaction, unfortunally not succesful
          I also delete in actualField > "state".
          And clear cache. gb whatsapp

          Nothing change.

          Is there more to be needed to change?
          if you are unable to hide or remove your state or full address, So What about changing the state or full address and adding wrong state or address which is also similar to hide it.
          Last edited by albertjoseph; 01-03-2023, 11:27 AM.

          Comment

          • yuri
            Member
            • Mar 2014
            • 8440

            #6
            Define a custom view for the address field type. https://docs.espocrm.com/development/custom-field-type/

            In your custom view define custom templates for detail and edit views: https://github.com/espocrm/espocrm/b...address.js#L43

            Define a custom function getFormattedAddress1
            https://github.com/espocrm/espocrm/b...ddress.js#L159

            Assuming you have address format = 1 set in the settings.

            Define a custom fetch function w/o state value fetcing. https://github.com/espocrm/espocrm/b...ddress.js#L639
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            • juliet
              Banned
              • Mar 2023
              • 1

              #7
              It appears that despite your efforts, the changes you made to the file and cache clearance did not yield the desired results. To troubleshoot further, consider checking other relevant fields, ensuring proper syntax, and confirming that all necessary steps have been followed. If issues persist, seeking technical support or consulting relevant documentation may provide a solution.

              Comment

              Working...