soderlind / acf-field-date-time-picker

Date and Time Picker field for Advanced Custom Fields v3 and v4
GNU General Public License v2.0
65 stars 27 forks source link

Hotfix to make it work as expected on append action #102

Closed GarethChidgey closed 8 years ago

GarethChidgey commented 8 years ago

I have also cleaned up the PHP for V5, it needed some TLC... other bits still do

jontascher-ae commented 8 years ago

I am manually patching this hotfix into my code since it has not been merged into the main plugin. I did, however, run into a problem when trying to use it. The error was:

timepicker.js?ver=2.0.15:36 Uncaught TypeError: Cannot read property 'search' of undefined

The reason for the issue is that $this in the loop is set to the containing td and not the input itself. This might be because I am using the timepicker inside of a flexible content field and not a standard repeater. The fix is to change line 32 to:

var input = $(this).find('input')

Maybe this can get added to the PR or at least help someone facing the same issue.