Cloning with programmatic data

Support General Cloning with programmatic data

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2570
    agorskiagorski
    Participant

    Hey all,
    I've got a potentially unique situation here, so I'm not sure if anyone can help. I'm getting data from an external API via AJAX, and I'd like to insert it alongside user data that's going into cloneable fields.

    Is there a way to hook in and use metabox.io's "clone()" JS function to accomplish this, or is there a programmatic way to add data fields to a meta box via JS?

    #2577
    Anh TranAnh Tran
    Keymaster

    Hi Sam,

    When is the data retrieved via Ajax? When editting a post?

    #2587
    agorskiagorski
    Participant

    Yeah, it's a button inside of a metabox that triggers it. I was able to kind of hack in the functionality by just triggering a click on the "Clone" button, locating the :last clone, and iterating through its fields. This is actually good enough for now, I wouldn't consider this a feature request, I was just curious if there was a built-in way.

    #2603
    Anh TranAnh Tran
    Keymaster

    This is not a built-in feature. I think the way you're doing is correct: getting data via Ajax and use JS to populate the inputs.

    We're building a premium extension for GeoCoding where the data is got from Google Maps Geocoding API via ajax and then populates all geolocation's fields. The principle is the same 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Cloning with programmatic data’ is closed to new replies.