Giter Site home page Giter Site logo

Video's are not saved about acf-audio-video HOT 4 CLOSED

ipsips avatar ipsips commented on August 10, 2024
Video's are not saved

from acf-audio-video.

Comments (4)

dfeldbrugge avatar dfeldbrugge commented on August 10, 2024 3

I think I resolved issue. Problem was in Javascript when rewriting hidden field based on input.
With new ACF name field is setup differently. If you have time maybe you can check? but this works for me now!

In javascript acf-audio-video-field.js __getInputName function needs rewrite.
Before (line from line 86)

__getInputName: function __getInputName() {
	    var inputName = this.$inputContainer.children(':first').attr('name').split('][');
	
	    if (inputName[inputName.length - 1].indexOf('field') == 0) return inputName.join('][');
	
	    inputName.splice(inputName.length - 1, 1);
	
	    return inputName.join('][') + ']';
	  },

After update

 __getInputName: function __getInputName() {
	    var inputName = this.$inputContainer.children(':first').attr('name').split('][');

	    return inputName;
	  },

from acf-audio-video.

dfeldbrugge avatar dfeldbrugge commented on August 10, 2024

Additional information:

ACF Pro v: 5.5.9
Wordpress v: 4.7.2

Video is uploaded and saved in media library.
When selecting the video and publish the video is not saved in DB.
In DB field is also empty. I use PHP to add ACF fields to posttype.

The field itself is stored in DB. But empty value.

from acf-audio-video.

 avatar commented on August 10, 2024

This fix no longer seems to work.

from acf-audio-video.

virgo79 avatar virgo79 commented on August 10, 2024

The previous code works only for the first selection. After saving the post for the first time, there is no way to change the selected media or to empty the field.

After investigating a bit, I've found that the hidden input that is used for storing the value into the database was altered during the media selection.

Using the following code, everything seems work fine.

__getInputName: function __getInputName() {
		
	var key = this.$field.data('key');
	var inputName = 'acf['+key+']';
	return inputName;		
	  
},

from acf-audio-video.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.