• Resolved ryvix

    (@ryvix)


    Not getting any help posting on github so thought maybe I should post here too. It seems like there should be some simple way to do it but I haven’t been able to decipher things and figure it out yet.

    I’m trying to figure out the best way to be able to copy elements from one relationship field to another. Basically one field is storing results from a search on posts in the database and one field will be the approved posts which will display on a custom page template.

    I’m currently using the Multiple Select, Autocomplete options for 2 relationship fields and want to be able to click elements in the results field and have them appear in the approved field. This is only for the admin screens in my case when editing the post.

    I’ve tried the other Selection Type and Format options but the Autocomplete seemed to work the best. I’m not sure if it would be better to just make a new field type or even how to go about doing that yet.

    I’ve figured out I can get the data from the field like this:

    let index = $('.pods-form-ui-row-name-results li.select2-selection__choice').index(this); let data = PodsDFV.fieldInstances['pods-form-ui-pods-meta-results'].fieldItemData[index]; PodsDFV.fieldInstances['pods-form-ui-pods-meta-approved'].fieldItemData.unshift(data);

    I have to add some way to make it not keep adding multiple copies once it already exists too if that’s even necessary, and find some way to make it render on the approved field.

    I tried doing this but that doesn’t seem to work so I’m guessing I’m missing something else.

    PodsDFV.fieldInstances['pods-form-ui-pods-meta-approved'].render(); jQuery(this).trigger('render');

    There has to be a better way to do all this but I can’t seem to figure it out. Any help is greatly appreciated!

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @ryvix

    GitHub is actually a better place for such topics. The fact that no one has replied yet is probably due to time or research reasons.
    Closing here and will reply on GitHub.

    Cheers, Jory

Viewing 1 replies (of 1 total)
  • The topic ‘Click to copy element to another relationship field’ is closed to new replies.