Custom Fields
Re-Envisioned
Support Meta Box Geolocation Auto populate an OSM field if empty

  • Creator
    Topic
  • #29112
    Tron Buck
    Participant

    I have read something about bind_if_empty idea in this forum but it doesn't work for me.
    Sometimes, OSM doesn't have the value "city" and I must use "town" value instead. Same happens with "suburb"/"city-district"/"neighborhood" values.
    I would like to use the "town" value when "city" value is empty.
    This is my no-luck approach:

    [
    'name' => __( 'City', 'miav2' ),
    'id' => $prefix . 'city2',
    'type' => 'text',
    'address_field' => 'address',
    'binding' => 'city',
    'bind_if_empty' => 'town',
    ],

    Any idea?
    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #29115
    Tron Buck
    Participant

    Another question:
    when trying to concatenate two values ("road" and "house_numer" for example)

    [
    'name' => __( 'Street', 'your-text-domain' ),
    'id'   => $prefix . 'street',
    'type' => 'text',
    'address_field' => 'address',
    'binding' => 'road + " " + house_number',
    ],

    I get this error

    geolocation.js?ver=1624388899:308 Uncaught ReferenceError: item is not defined
        at geolocation.js?ver=1624388899:308
        at Array.forEach (<anonymous>)
        at Osm.getFieldData (geolocation.js?ver=1624388899:301)
        at Osm.populateField (geolocation.js?ver=1624388899:52)
        at geolocation.js?ver=1624388899:33
        at Array.forEach (<anonymous>)
        at Osm.populateFromAddress (geolocation.js?ver=1624388899:33)
        at HTMLInputElement.<anonymous> (geolocation.js?ver=1624388899:253)
        at HTMLInputElement.dispatch (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.7.2:2)
        at HTMLInputElement.v.handle (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.7.2:2)
    #29140
    Long Nguyen
    Moderator

    Hi,

    Thank you for your feedback.

    I will check the settings bind_if_empty and get back to you later.

    Regarding the binding address, it only accepts one address component. If you add two components, the error message will appear.

    #29431
    Tron Buck
    Participant

    Hi Long.
    Any news about the bind_if_empty issue?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.