Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Injecting ACF values #1

Open
PthPndr opened this issue Jan 19, 2017 · 6 comments
Open

Injecting ACF values #1

PthPndr opened this issue Jan 19, 2017 · 6 comments

Comments

@PthPndr
Copy link

PthPndr commented Jan 19, 2017

Hello, I recently stumbled across your ACF field and had a question.

If I try an AJAX GET with the following it works great:
/wp-admin/admin-ajax.php?action=some_action

If I try following your example and inject an ACF value nothing happens when I click the button:
/wp-admin/admin-ajax.php?action=some_action&var={acf[field_5691f90569c3a]}

Admittedly, I do not have a lot of experience when it comes to AJAX and it could be entirely me but is this still the correct format for injecting ACF values?

@SnakeO
Copy link
Owner

SnakeO commented May 23, 2017

You need to pull the field_id from the ACF field. If you are in the custom fields page, click on "screen options" and then select "show field slugs" (or something along those lines). That's where you get the field_* identifier.

@samjco
Copy link
Contributor

samjco commented May 23, 2017

Hey Snake!

Can you write up an full example of how the AJAX GET works with screenshots?

@RURAWEB
Copy link

RURAWEB commented Jul 8, 2018

Hello SnakeO,
I'm using your plugin with ACF Pro. I need a button that open this url with some ACF field injected :

https://www.google.com/calendar/render?action=TEMPLATE&text=&dates={acf[field_5b41d7b3afe8b]}T{acf[field_5b41e65c385ae]}/{acf[event-date-start]}T{f[acf[field_5b41e65c385ae]}T{acf[field_5b41e9367f162]}&details=&location={acf[field_5b41d82496b23]}&sf=true&output=xml

But I receive an issue:
Error: Syntax error, unrecognized expression: input[name=acf[field_5b41d7b3afe8b]]

What's wrong with my syntax? However I pull the field_id from the ACF field. I'm lost!

@webarter
Copy link

I believe the plugin is broken in that regard

@webarter
Copy link

webarter commented Mar 10, 2020

got to adjust it manually

file button-v5.php in the source code, line 235

there have to be brackets in input[name="field_...."]

otherwise jquery throws exception.

so line 235 to make it work:
var val = $('input[name="' + name + '"]').val();

@SnakeO
Copy link
Owner

SnakeO commented Mar 10, 2020

Thanks, I see there was a pull request for that. I've added it into the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants